访问派生类中的受保护成员
class Base{ protected: int b; public: void DoSomething(const Base& that) { b+=that.b; }};
class Derived : public Base{ protected: int d; public: void DoSomething(const Base& that) { b+=that.b; d=0; }};
DoSomething
Base
Derived
that.b
Derived
cannot access protected member
b
b
慕码人2483693
杨魅力
白衣染霜花
相关分类