Yes, a B can access protected members of an A. But it’s the fact that you’re going through v3 that makes it essentially irrelevant that this attempt is made from within a member function of B. It’s v3 trying to make the access, not B::calculate, and v3 is not a B&.
[C++11: 11.4/1]:[..] All other accesses involve a (possibly implicit) object expression (5.2.5). In this case, the class of the object expression shall beCor a class derived fromC.
… followed by a bunch of examples showing exactly your problem.
0
solved Can’t seems to inherit a protected variable