C ++ Inheritance Syntax

Possible duplicate:
What are access specifiers? Should I inherit confidential, secure, or open?
The difference between private, open and protected inheritance in C ++

To all of you cpp experts, In C ++ inheritance

class B : public A { }; 

I'm just wondering why you need to know a keyword here? It means something?

+4
source share
1 answer

This means that public members in A are inherited by B and are also public from B

Alternatives:

  • protected - public members from A are protected in B , others are saved the same.

  • private - All members from A are made private in B

Rules do not apply to methods that are hidden or overridden.

+8
source

Source: https://habr.com/ru/post/1390306/


All Articles