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

推薦閱讀
- LabVIEW 2018 虛擬儀器程序設計
- Vue.js 3.x從入門到精通(視頻教學版)
- OpenCV 3和Qt5計算機視覺應用開發
- 實戰Java程序設計
- Apache Mahout Clustering Designs
- 劍指Java:核心原理與應用實踐
- Getting Started with Hazelcast(Second Edition)
- Learning Apache Cassandra
- Flowable流程引擎實戰
- 時空數據建模及其應用
- Hands-On Kubernetes on Windows
- PrimeFaces Blueprints
- H5+移動營銷設計寶典
- 官方 Scratch 3.0 編程趣味卡:讓孩子們愛上編程(全彩)
- Web前端測試與集成:Jasmine/Selenium/Protractor/Jenkins的最佳實踐