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
4.5 Assignment compatibility relationship between a base class and a derived class objectUnder certain conditions, type conversions can be made between different types of data, such as the ability to assign integer data to a double type
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
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
Item 7: declare Destructors (destructor) as virtual in polymorphic base classes (polymorphism base class)
By Scott Meyers
Translator: fatalerror99 (itepub's nirvana)
Release: http://blog.csdn.net/fatalerror99/
There are many ways to get the time, so
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
In the example mentioned in "Multi-inheritance", Class A, CLASS B1, Class B2, and class C constitute the hierarchy of class inheritance. In this structure, the object of class C will contain sub-objects of Two Classes. Because Class A is a public
1. member functions that cannot be automatically inherited
Constructor (including copy constructor)
Destructor= Operator
Ii. Inheritance and constructor
The constructor of the base class is not inherited. You must declare your own constructor In
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.