Inheriting private members in C++

前端 未结 7 1969
不知归路
不知归路 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条回答
  •  心在旅途
    2020-12-03 00:27

    Because the getters and setters are public -- they're callable by anyone, not just derived classes.

提交回复
热议问题