View Single Post
Old 04-10-2003, 07:28 AM   #1 (permalink)
Kportertx
Registered User
 
Join Date: Apr 2003
Posts: 11
Kportertx is on a distinguished road
pointer to function with class?

PAcct is a pointer to a class, the class is points to can change.
in total there are 3 classes PAcct can point to, one base and 2 derived classes.

ok here is the problem I can delcare a array of pointers to functions like this
void (* Transaction[3])() ={Deposit ,Withdrawl,ShowAll}; //declaring an array of pointer to functions

but deposit withdrawl and show all are all in a class so how i need to access them is like this

void (* Transaction[3])() ={PAcct->Deposit ,PAcct->Withdrawl,PAcct->ShowAll}; //declaring an array of pointer to functions

but when I do this I get an compile error that says this

error C2440: 'initializing' : cannot convert from 'void' to 'void (__cdecl *)(void)'
Expressions of type void cannot be converted to other types

[code]C:\Documents and
Kportertx is offline   Reply With Quote