Only a class, subclasses, or friend classes and methods can access a protected member. The only way to access the protected member is to subclass the class, and then use your subclass to protect the protected member.
For instance:
class parent {
protected:
int foo();
}
class child : public parent {
public:
int foo();
}
source
share