1. The derived new class has the following features (mainly the first two points ):
1.A derived class is a continuation of a base class definition.---Any member of the base class can be implicitly contained in the derived class.
2.A derived class is an extension of the base class definition.---You can redefine a new member in a derived class (in the "part5" section, you can also see that the function of the base class member function can be changed or expanded in the derived class ).
3.A derived class can be a combination of base classes.---A derived class can be derived from multiple base classes. A derived class is a combination of attributes and behaviors of all base classes.
Summary:Accept all or part of data or functions (actions, Operations) from one or more previously defined classes (called direct base classes ), in addition, the original members are redefined and new members are added, so a new low-level class (called a direct derived class) is formed ). The derived class can be used as the direct base class of the lower-level derived class.
In this way, the hierarchy of classes is established)
AvailableDirected Acyclic Graph(Directed acyclic graph, dag)Indicates the inheritance relationship.
2. Note
1. Non-static data is stored in the memory stack space
2. UseNewDynamically allocated data is stored in the memory heap space and
3. static data and global variables are stored in the memory data space,
These three types of data are never stored in the same memory space.
The object of the base class and the derived class is not an object.
3. The derived class object is assigned a value to the base class object, but this is not the case ., You can assign a value to "X1" from the right to the left, but this is not the case.