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

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:

主站蜘蛛池模板: 景宁| 武强县| 湖南省| 莒南县| 唐河县| 图木舒克市| 通山县| 泸西县| 玛纳斯县| 崇信县| 乌什县| 赞皇县| 尚义县| 阜城县| 离岛区| 吐鲁番市| 永宁县| 宜君县| 越西县| 比如县| 信宜市| 讷河市| 晋州市| 丘北县| 景泰县| 喜德县| 巴彦淖尔市| 伊金霍洛旗| 农安县| 白银市| 石狮市| 布尔津县| 东阿县| 沙湾县| 淮南市| 岑巩县| 凌源市| 卢氏县| 兴义市| 鄱阳县| 新蔡县|