Common inheritance (public) inheritance, private inheritance, and protection Inheritance (protected) are the three commonly used methods of inheritance.1. Public inheritancePublic inheritance is characterized by the public and protected members of
Public, private, and protected are common inheritance methods.
1. Public inheritance)
Public inheritance is characterized by the original state of both the public members of the base class and the protected members as the members of the derived
Public and private inheritance (private), protected inheritance (protected) are three commonly used methods of inheritance. 1. Public inheritance Public inheritance is characterized by public members of the base class and protected members as
University career, involving the scope of the class, inheritance are used by the public common inheritance, at that time did not think so much, feel the common inheritance more convenient, how simple, anyway, there is no too many restrictions,
Three Access Permissions
Public: can be accessed by any entity
Protected: only access to child classes and member functions of this class is allowed.
PRIVATE: only access to member functions of this class is allowed.
Three inheritance
One, polymorphic
C + + polymorphism is implemented through inheritance and dynamic binding. Inheritance is the inheritance and sharing of code or function, which is external, formal and easy to understand from the point of view of language. Dynamic
Three kinds of access rights
Public : can be accessed by any entity
protected: only child classes and member functions of this class are allowed to access
Private: only member functions of this class are allowed to access
Three ways of
Public, private, and protected inheritance (protected) are three common ways to inherit.1. Public inheritancePublic inheritance is characterized by the public and protected members of the base class as members of the derived class, which remain in
Public, private, and protected inheritance (protected) are three common ways to inherit.1. Public inheritancePublic inheritance is characterized by the public and protected members of the base class as members of the derived class, which remain in
C + + Object-oriented language A major difficulty is inheritance, but it has to be mastered. Simple inheritance is easy to understand, but when it comes to multiple inheritance, design to virtual function inheritance, especially when it comes to
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.