众所周知,在C++中类成员能够具有三种访问权限,分别为public/protected/private:[ISO/IEC 14882:2014]A member of a class can beprivate: that is, its name can be used only by members and friends of the class in which it is declared.protected: that is, its name can be used only by members and friends of the class in which it is declared, by classes derived from that class, and by their friends (see 11.4).public: that is, its name can be used anywhere without access restriction.从标准意图上来看,是希望隐藏类的实现细节和底层数据,即为封装。但是我们也可以通过一些特殊的方式来突破访问权限的限制。
...
继续阅读
(49)