I cant call protected function in my base class. Why? It looks something like this:
class B : B2
{
public:
virtual f1(B*)=0;
protected:
virtual f2(B*) { codehere(); }
}
class D : public B
{
public:
virtual f1(B*b) { return f2(b); }
protected:
virtual f2(B*b) { return b->f2(this); }
}
In msvc I get the error error C2248: 'name::class::f2' : cannot access protected member declared in class 'name::class'
In gcc I get error: 'virtual int name::class::f2()' is protected.
Why is that? I thought the point of protected members is for derived classes to call.