- 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:

推薦閱讀
- 現代C++編程:從入門到實踐
- Raspberry Pi for Python Programmers Cookbook(Second Edition)
- Rust實戰
- 精通搜索分析
- PLC編程及應用實戰
- Learn React with TypeScript 3
- SAP BusinessObjects Dashboards 4.1 Cookbook
- 劍指大數據:企業級數據倉庫項目實戰(在線教育版)
- Learning PHP 7
- Cocos2d-x Game Development Blueprints
- Mastering AWS Security
- Extending Unity with Editor Scripting
- Node.js區塊鏈開發
- 產品架構評估原理與方法
- Building Scalable Apps with Redis and Node.js