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

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:

主站蜘蛛池模板: 和林格尔县| 安康市| 越西县| 南和县| 万山特区| 柳州市| 江永县| 稷山县| 琼海市| 昌平区| 安乡县| 巩留县| 兴文县| 杂多县| 彰武县| 苏州市| 万盛区| 云南省| 萨迦县| 阿巴嘎旗| 嫩江县| 星子县| 会昌县| 拉孜县| 绵阳市| 明星| 黑龙江省| 闵行区| 吴江市| 噶尔县| 苍梧县| 惠东县| 锡林浩特市| 沧源| 于田县| 资源县| 贡山| 会昌县| 古浪县| 石城县| 南充市|