开发者

C++ inheritance type [duplicate]

开发者 https://www.devze.com 2023-02-07 04:50 出处:网络
This question already has answers here: Closed 12 years ago. Possible Duplicate: Default inheritance access specifie开发者_开发技巧r
This question already has answers here: Closed 12 years ago.

Possible Duplicate:

Default inheritance access specifie开发者_开发技巧r

When class A inherits from class B:

class A: B {...}

Since I didn't specify the type of inheritance, What will the type of inheritance be? Will it be private since it is the default? Or, is there some sort of dependency here? In other words, will the inheritance type depend on the inherited class or the inheriting class?

Thanks.


If you don't specify anything, it will be private by default for classes. For structs it will be public by default.

0

精彩评论

暂无评论...
验证码 换一张
取 消