Click here to Skip to main content
15,913,911 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Check box control Pin
David Crow24-Oct-03 2:59
David Crow24-Oct-03 2:59 
GeneralRe: Check box control Pin
SLiDeR24-Oct-03 5:55
SLiDeR24-Oct-03 5:55 
GeneralRe: Check box control Pin
David Crow24-Oct-03 6:14
David Crow24-Oct-03 6:14 
GeneralRe: Check box control Pin
Steve Obbayi24-Oct-03 3:22
professionalSteve Obbayi24-Oct-03 3:22 
GeneralRe: Check box control Pin
Anonymous24-Oct-03 5:51
Anonymous24-Oct-03 5:51 
GeneralAbout MAP Development in which i can display longitude and latitude information Pin
Member 99701023-Oct-03 20:24
Member 99701023-Oct-03 20:24 
GeneralRe: About MAP Development in which i can display longitude and latitude information Pin
Ted Ferenc23-Oct-03 21:40
Ted Ferenc23-Oct-03 21:40 
Questionusing typedef on class function pointer ? Pin
not_happy023-Oct-03 20:03
not_happy023-Oct-03 20:03 
I have a cpp question that can not resolved... need some great help.

I have a base class, and some derived class (with various functions). I am trying to use a callback mechanism to have the base class to call one of the derived class function.

// ***************************
//
class BaseClass;
typedef int (BaseClass::*BaseCallback)( int );

class BaseClass
{
public:
BaseClass() {};
BaseCallback baseCB;

// error on below line:
// error C2171: '*' : illegal on operands of type 'BaseCallback'
// error C2064: term does not evaluate to a function
int runCallback( int i ) { return (*baseCB)(i); };
};

class DerivedClass : public BaseClass
{
public:
bool derivedCallback( int i ) { return i; };
DerivedClass() { baseCB = (BaseCallback) derivedCallback; };
};
//
// ***************************

everything seems to be good, except when the compiler does not like to call the function using the function pointer. This mechanism does work if it is not a class function pointer. Does anyone has any idea ?

thanks in advance

AnswerRe: using typedef on class function pointer ? Pin
Michael Dunn23-Oct-03 20:18
sitebuilderMichael Dunn23-Oct-03 20:18 
GeneralRe: using typedef on class function pointer ? Pin
not_happy023-Oct-03 21:26
not_happy023-Oct-03 21:26 
AnswerRe: using typedef on class function pointer ? Pin
Iain Clarke, Warrior Programmer24-Oct-03 3:43
Iain Clarke, Warrior Programmer24-Oct-03 3:43 
GeneralRe: using typedef on class function pointer ? Pin
Michael Dunn24-Oct-03 12:33
sitebuilderMichael Dunn24-Oct-03 12:33 
GeneralRe: using typedef on class function pointer ? Pin
Iain Clarke, Warrior Programmer26-Oct-03 0:16
Iain Clarke, Warrior Programmer26-Oct-03 0:16 
GeneralRe: using typedef on class function pointer ? Pin
Iain Clarke, Warrior Programmer26-Oct-03 0:32
Iain Clarke, Warrior Programmer26-Oct-03 0:32 
GeneralRe: using typedef on class function pointer ? Pin
Mike O'Neill24-Oct-03 14:12
Mike O'Neill24-Oct-03 14:12 
GeneralRe: using typedef on class function pointer ? Pin
Iain Clarke, Warrior Programmer26-Oct-03 0:13
Iain Clarke, Warrior Programmer26-Oct-03 0:13 
GeneralRe: using typedef on class function pointer ? Pin
Mike O'Neill26-Oct-03 11:32
Mike O'Neill26-Oct-03 11:32 
GeneralRe: using typedef on class function pointer ? Pin
Iain Clarke, Warrior Programmer26-Oct-03 22:39
Iain Clarke, Warrior Programmer26-Oct-03 22:39 
AnswerRe: using typedef on class function pointer ? Pin
Michael Dunn24-Oct-03 12:35
sitebuilderMichael Dunn24-Oct-03 12:35 
GeneralRe: using typedef on class function pointer ? Pin
not_happy028-Oct-03 14:20
not_happy028-Oct-03 14:20 
Generalunocows.lib Pin
nikoladsp23-Oct-03 19:10
nikoladsp23-Oct-03 19:10 
GeneralRe: unocows.lib Pin
Shog923-Oct-03 19:51
sitebuilderShog923-Oct-03 19:51 
GeneralMSChart question Pin
nikoladsp23-Oct-03 19:07
nikoladsp23-Oct-03 19:07 
GeneralAnother registry question Pin
dafunkt23-Oct-03 18:42
dafunkt23-Oct-03 18:42 
GeneralRe: Another registry question Pin
Michael Dunn23-Oct-03 19:04
sitebuilderMichael Dunn23-Oct-03 19:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.