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

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.

主站蜘蛛池模板: 伊宁县| 海南省| 都安| 玉门市| 康平县| 庆云县| 大英县| 屏东市| 和政县| 合山市| 靖边县| 乐都县| 乐安县| 准格尔旗| 福安市| 威海市| 赤峰市| 宜宾县| 湛江市| 广丰县| 周至县| 海南省| 承德县| 余庆县| 浦城县| 民乐县| 平昌县| 滦南县| 云浮市| 行唐县| 大方县| 高平市| 任丘市| 苏州市| 刚察县| 通山县| 唐山市| 兰考县| 通渭县| 腾冲县| 教育|