Hi
I'm using Visual C++ .Net version 1.1,
but this might be a general C++ question really.
Say we have a base class A with a protected member function "f", and a derived class B with some member function "g".
Now inside "g", I can access "f" for the "this" pointer, in other words:
f();
or
this->f();
compiles (which it should).
But if I try to access the same "f" for another pointer, it gives an error (C2248, cannot access protected member).
Even ((B* const)this)->f(); won't compile.
Is this expected behavior? Or is it just a problem with the MS compiler?
Thanks..
I'm using Visual C++ .Net version 1.1,
but this might be a general C++ question really.
Say we have a base class A with a protected member function "f", and a derived class B with some member function "g".
Now inside "g", I can access "f" for the "this" pointer, in other words:
f();
or
this->f();
compiles (which it should).
But if I try to access the same "f" for another pointer, it gives an error (C2248, cannot access protected member).
Even ((B* const)this)->f(); won't compile.
Is this expected behavior? Or is it just a problem with the MS compiler?
Thanks..