- Game Development Patterns and Best Practices
- John P. Doran Matt Casanova
- 100字
- 2021-07-02 23:43:40
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:

推薦閱讀
- Mastering Zabbix(Second Edition)
- 算法精粹:經典計算機科學問題的Java實現
- Django開發從入門到實踐
- Visual Basic程序設計實驗指導(第4版)
- Amazon S3 Cookbook
- Python數據可視化之Matplotlib與Pyecharts實戰
- 人人都懂設計模式:從生活中領悟設計模式(Python實現)
- Learning Network Forensics
- Express Web Application Development
- Java高并發編程詳解:深入理解并發核心庫
- Professional JavaScript
- 深入大型數據集:并行與分布化Python代碼
- Raspberry Pi開發實戰
- Serverless從入門到進階:架構、原理與實踐
- 你也能看得懂的Python算法書