Inheriting private members in C++

前端 未结 7 1957
不知归路
不知归路 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.

    0 讨论(0)
提交回复
热议问题