- 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.
- 漫話大數(shù)據(jù)
- Building Computer Vision Projects with OpenCV 4 and C++
- 輕松學(xué)大數(shù)據(jù)挖掘:算法、場(chǎng)景與數(shù)據(jù)產(chǎn)品
- SQL Server 2012數(shù)據(jù)庫(kù)技術(shù)與應(yīng)用(微課版)
- 數(shù)據(jù)庫(kù)應(yīng)用基礎(chǔ)教程(Visual FoxPro 9.0)
- WS-BPEL 2.0 Beginner's Guide
- 數(shù)據(jù)革命:大數(shù)據(jù)價(jià)值實(shí)現(xiàn)方法、技術(shù)與案例
- 達(dá)夢(mèng)數(shù)據(jù)庫(kù)性能優(yōu)化
- 數(shù)亦有道:Python數(shù)據(jù)科學(xué)指南
- Starling Game Development Essentials
- 深入淺出 Hyperscan:高性能正則表達(dá)式算法原理與設(shè)計(jì)
- SQL應(yīng)用及誤區(qū)分析
- 聯(lián)動(dòng)Oracle:設(shè)計(jì)思想、架構(gòu)實(shí)現(xiàn)與AWR報(bào)告
- Filecoin原理與實(shí)現(xiàn)
- 中國(guó)云存儲(chǔ)發(fā)展報(bào)告