官术网_书友最值得收藏!

Inheritance

Another important principle of object-oriented programming is inheritance. Let's say our game had four different kinds of weapons: Pistols, machine guns, sniper rifles, and laser cannons. A lot of the functionality of those guns would be the same. They would each have ammo, damage, accuracy, and so on. Instead of having to duplicate all that code, they could all inherit the basic functionality of a weapon and change the properties they needed to to get their specific functionality.

主站蜘蛛池模板: 广东省| 金秀| 濮阳市| 永福县| 贺兰县| 志丹县| 科尔| 饶阳县| 舞钢市| 合山市| 丰镇市| 绥中县| 景洪市| 花莲市| 丹寨县| 石台县| 普安县| 深水埗区| 永丰县| 安福县| 大方县| 江达县| 朝阳市| 西城区| 泸溪县| 达日县| 英超| 谷城县| 土默特左旗| 阜新| 芜湖市| 旺苍县| 武清区| 老河口市| 加查县| 合肥市| 泸水县| 辽中县| 资兴市| 贵州省| 兰州市|