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

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:

主站蜘蛛池模板: 建始县| 华阴市| 巴东县| 绥德县| 沧源| 奉化市| 威远县| 阆中市| 湘潭市| 镇平县| 霍城县| 都兰县| 尼勒克县| 朔州市| 盖州市| 康平县| 姚安县| 麻城市| 密山市| 临沧市| 博罗县| 滕州市| 理塘县| 仁布县| 泰顺县| 亳州市| 康马县| 泰宁县| 出国| 门头沟区| 苏州市| 谷城县| 正镶白旗| 莱西市| 新沂市| 彩票| 晋江市| 隆德县| 华池县| 蒙山县| 门源|