- Hands-On Design Patterns with Java
- Dr. Edward Lavieri
- 144字
- 2021-06-24 14:57:57
Inheritance
Inheritance in programming is the same as in real life. A girl inherits from her mother, who inherits from her mother, and so on. The following diagram shows inheritance in the real world and how it relates to OOP:

On the left-hand side of the preceding diagram, a Grandmother passes down traits to the Daughter, who passes down traits to the Granddaughter. So, the Granddaughter inherits from both the Daughter and Grandmother. The same inheritance concept applies to our Bicycle class, which inherits from both the Two-Wheeled class and the Vehicle class. This is a powerful schema as it avoids class bloating. As an example, if the Vehicle class has data elements such as year, make, and model, those elements are automatically part of the Two-Wheeled and Bicycle classes. We will see an example of this later on in this chapter.
- Hands-On Data Structures and Algorithms with Rust
- LibGDX Game Development Essentials
- Hands-On Machine Learning with Microsoft Excel 2019
- Python金融大數據分析(第2版)
- MySQL從入門到精通(第3版)
- 數據結構與算法(C語言版)
- Lean Mobile App Development
- Oracle 12c云數據庫備份與恢復技術
- Lego Mindstorms EV3 Essentials
- 網站數據庫技術
- 云原生數據中臺:架構、方法論與實踐
- Power BI智能數據分析與可視化從入門到精通
- Oracle數據庫管理、開發與實踐
- Visual FoxPro數據庫技術基礎
- Gideros Mobile Game Development