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

Inheritance

First of all, we have inheritance, which shows the IS-A relationship between classes.

class FlyingEnemy: public Enemy 
{
public:
void Fly(void);
private:
int flySpeed;
};

When an object inherits from another object, it has all of the methods and fields that are contained in the parent class, while also adding their own content and features. In this instance, we have a special FlyingEnemy, which has the ability to fly in addition to all of the functionality of the Enemy class.

In UML, this is normally shown by a solid line with a hollow arrow and looks like the following:

主站蜘蛛池模板: 怀集县| 郯城县| 大邑县| 南涧| 湘西| 甘洛县| 九龙县| 肃宁县| 于都县| 五莲县| 吉木乃县| 荔浦县| 哈巴河县| 如皋市| 邵阳县| 广元市| 郑州市| 双牌县| 宝丰县| 利津县| 黄石市| 屏边| 赫章县| 屯昌县| 海阳市| 南皮县| 河源市| 察隅县| 云霄县| 岚皋县| 钟祥市| 抚顺县| 铅山县| 绥德县| 陕西省| 原平市| 五大连池市| 施秉县| 射阳县| 周口市| 平邑县|