From http://www.parashift.com/c++-faq-lite/basics-of-inheritance.html#faq-19.5
A member (either data member or member function) declared in a protecte
You are not accessing protected function in your derived class, you are trying to overload it and promote from protected to public. This is a forbidden action, you only can hide functions in derived class, e.g. overload protected function as a private.
Accessing protected function means call it from some member of a class:
class Y : public X
{
public:
void call() {
fun();
}
}
or like you call it by objX.fun(); is also correct.