Inheriting private members in C++

前端 未结 7 1965
不知归路
不知归路 2020-12-02 23:59

suppose a class has private data members but the setters and getters are in public scope. If you inherit from this class, you can still call those setters and getters -- ena

7条回答
  •  Happy的楠姐
    2020-12-03 00:25

    A derived class doesn't inherit access to private data members. However, it does inherit a full parent object, which contains any private members which that class declares.

提交回复
热议问题