Do Sub-Classes Really Inherit Private Member Variables?

前端 未结 7 987
醉酒成梦
醉酒成梦 2020-12-07 23:58

Basically as far as I know, when you create a base class with a public, protected, and private section and variables/functions in each the public and protected sections will

7条回答
  •  佛祖请我去吃肉
    2020-12-08 00:04

    This may help

    #include
    using namespace std;
    
    class A
    {
    int b;  
    };
    
    class B : private A
    {
    
    };
    
    int main()
    {
    C obj;
    cout<

提交回复
热议问题