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

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.

主站蜘蛛池模板: 顺昌县| 安陆市| 清苑县| 松桃| 马山县| 武夷山市| 丰台区| 汝州市| 平舆县| 吴堡县| 金门县| 溆浦县| 突泉县| 湖南省| 张家界市| 惠东县| 藁城市| 原阳县| 西和县| 三明市| 康定县| 米泉市| 精河县| 旬阳县| 夏邑县| 阳信县| 抚松县| 太保市| 亚东县| 新化县| 信丰县| 沽源县| 策勒县| 六枝特区| 府谷县| 湘乡市| 黑山县| 南和县| 汉沽区| 浮梁县| 新田县|