N
noel.hunt
I have a base class, PadRcv, with virtual functions. User code
will derive from this class and possibly supply it's own functions
to override the base class virtual functions. How can I test that
a user-defined class has overriden the virtual function in the
base class?
I have code like this which compiles with gcc 2.95.4:
Attrib Implicits(PadRcv *obj){
Attrib accum = 0;
PadRcv *padrcv;
if( !obj ) return 0;
char* (PadRcv::*pmfa)(char *) = &PadRcv::kbd;
void (PadRcv::*pmfb)() = &PadRcv::userclose;
if( obj->*pmfa != &PadRcv::kbd ) accum |= ACCEPT_KBD;
if( obj->*pmfb != &PadRcv::userclose ) accum |= USERCLOSE;
return accum;
}
With gcc 3.4.4, I get the following errors:
pad.C: In function `Attrib Implicits(PadRcv*)':
pad.C:27: error: invalid use of non-static member function
pad.C:28: error: invalid use of non-static member function
*** Error code 1
There is plenty of documentation on the net for pointers to member
functions and virtual functions but nothing seems to cover this
particular area.
will derive from this class and possibly supply it's own functions
to override the base class virtual functions. How can I test that
a user-defined class has overriden the virtual function in the
base class?
I have code like this which compiles with gcc 2.95.4:
Attrib Implicits(PadRcv *obj){
Attrib accum = 0;
PadRcv *padrcv;
if( !obj ) return 0;
char* (PadRcv::*pmfa)(char *) = &PadRcv::kbd;
void (PadRcv::*pmfb)() = &PadRcv::userclose;
if( obj->*pmfa != &PadRcv::kbd ) accum |= ACCEPT_KBD;
if( obj->*pmfb != &PadRcv::userclose ) accum |= USERCLOSE;
return accum;
}
With gcc 3.4.4, I get the following errors:
pad.C: In function `Attrib Implicits(PadRcv*)':
pad.C:27: error: invalid use of non-static member function
pad.C:28: error: invalid use of non-static member function
*** Error code 1
There is plenty of documentation on the net for pointers to member
functions and virtual functions but nothing seems to cover this
particular area.