Ditai C++ Study Notes-Lesson 47-Conflict between Father and Son

Conflict between parent and child-about members with the same name:
(1) The subclass can define the members with the same name in the parent class
(2) The members in the subclass will hide the members with the same name in the parent class
(3) The members with the same name in the parent class still exist In the subclass
(4) access the members of the same name in the parent class through the scope discriminator (::)

Conflict between parent and child-about the function of the same name
(1) the function in the child class will hide the function of the same name in the parent class
(2) the child class cannot override the member function in the parent class
(3) use the scope discriminator to access the function in the parent class Functions with the same name
(4) Subclasses can define exactly the same member functions in the parent class

Guess you like

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