How to return void function pointer

Joined
Mar 22, 2008
Messages
3
Reaction score
0
hello all
im facing a problem that confusing me allot dealing member functions
here is the thing :

i have class A :

class A {

getCallBack(void (*)()){
}

}

then i have class B:
that has few member functions that i like to pass to class A function

class B {
void CallBack1(void){
}

}

now no matter what i do im keep getting compiler errors
for example when i try to do
B b = new B()
A::getCallBack(b->CallBack1);

now the second question is how can i construct factory class that will return me the void callback members functions
accourding to something .
here im also facing allots of problems for example if i try to do something like this :

void (*B::CreateCallBack(int type))(void){

void (*p)(void);

switch(type){

case 1: {

p= B.*CallBack1();

break;
}
default:
break;

}
return p;
}



what im doing wrong here ?
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,810
Latest member
Kassie0918

Latest Threads

Top