Default inheritance access specifier

前端 未结 9 1714
北海茫月
北海茫月 2020-12-04 19:12

If I have for example two classes A and B, such that class B inherits A as follows:

class B: public A

9条回答
  •  感情败类
    2020-12-04 19:39

    The default type of the inheritance is private in C++.

    class B:A
    {};
    

    is equivalent to

    class B: private A
    {};
    

提交回复
热议问题