Ditai C++ Study Notes-Lesson 43-The Concept and Significance of Inheritance

Inheritance in object-oriented refers to the parent-child relationship between classes
(1) the subclass has all the attributes and behaviors of the parent
(2) the subclass is a special relationship
(3) the subclass object can be used as the parent class object
( 4) Subclasses can add methods and properties that the parent class does not have

Rule
(1) The subclass is a special parent class
(2) The subclass object can directly initialize the parent class object
(3) The subclass object can be directly assigned to the parent class object

Guess you like

Origin blog.csdn.net/cj532419842/article/details/115193728