subtle C++ inheritance error with protected fields

后端 未结 6 946
無奈伤痛
無奈伤痛 2020-12-03 02:38

Below is a subtle example of accessing an instance\'s protected field x. B is a subclass of A so any variable of type B is also of type A. Why can B::foo() access b\'s x fie

6条回答
提交回复
热议问题