#include
class Base
{
protected:
void somethingProtected()
{
std::cout << \"lala\" << std::endl;
}
};
class Deri
The Derived class can only access the protected base member in Derived objects. It cannot access the member in objects that are not (necessarily) Derived objects. In the cases that fail, you are trying to access the member via a Base &, and since this might refer to an object that is not Derived, the access can't be made.