problems taking a pointer to member-function of a protected method in a derived class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I don't know, if this list is appropriate, as this is a general C++-Question, but anyway...

I ran into some problems with the following Codepiece:

class Base
{
   protected:
       typedef void (Base::*FuncPtr)();

       virtual void func();
};

class Derived: public Base
{
   virtual void func();
   Derived()
   {
       FuncPtr p = &Base::func;
   }
};

g++ tells me, that i can't access it, because it is taken via Base. If the method wouldn't be virtual, it could be referenced as "&Derived::func". Currently the only solution to me seems to make func public - which is not intended by design.
Are there other possibilities?

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux