Accessing protected members in a derived class

前端 未结 8 2121
礼貌的吻别
礼貌的吻别 2020-11-22 11:30

I ran into an error yesterday and, while it\'s easy to get around, I wanted to make sure that I\'m understanding C++ right.

I have a base class with a protected memb

8条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-22 11:57

    You have access to the protected members of Derived, but not those of Base (even if the only reason it's a protected member of Derived is because it's inherited from Base)

提交回复
热议问题