* problems taking a pointer to member-function of a protected method in a derived class
@ 2007-10-21 21:50 Rene Buergel
0 siblings, 0 replies; only message in thread
From: Rene Buergel @ 2007-10-21 21:50 UTC (permalink / raw)
To: gcc-help
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?
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-10-21 14:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-21 21:50 problems taking a pointer to member-function of a protected method in a derived class Rene Buergel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).