Very detailed! Reprint LinkConversion of C + + base classes to derived classesIn public inheritance, private inheritance, and protection inheritance, only public inheritance preserves the characteristics of the base class well, preserving all
C + + base class and derived class conversionsIn public inheritance, in private inheritance and protection inheritance, only public inheritance can preserve the characteristics of the base class, it retains all members of the base class except
We know that if a derived class has more than one direct base class, and these direct base classes have a common base class, then in the final derived class, multiple copies of the same name members of the indirect common base class data member are
Base classThe inheritance process creates a new derived class that consists of the members of the base class plus any new members added by the derived class. In multiple inheritance, you can build an inheritance diagram in which the same base class
Object-Oriented Programming-Overview, definition of base classes and derived classes
Introduction:
Object-Oriented programming is based on three basic concepts: data abstraction, inheritance, and dynamic binding.
In C ++,Data abstraction using
C + + clearly states: when the derived class object is deleted by a base class pointer, and the base class takes a non-virtual destructor, the result is undefined-- The actual execution usually occurs when the derived component of the object is not
Transferred from: http://www.cnblogs.com/sujz/articles/2044365.htmlThe inheritance of derived classes is summarized as follows:
How to Inherit
Description
Public
The public and protected members of the base
1, why the size of the class is not allowed in C + + is 0Class Zerosizet {}; Zerosizet Z[10];&z[i]-&z[j]; is usually obtained by dividing the number of bytes between two addresses by the type size, while the type size is 0 will be problematic2, why
There is an assignment-compatible relationship between the base class and the derived class object, because the derived class contains members that inherit from the base class, in the following respects, the required friend can refer to the only
Only a public derived class is a true subtype of the base class, and it inherits the functionality of the base class completely. There is an assignment-compatible relationship between the base class and the derived class object, because the derived
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.