Hi, Im trying to create a call back by passing a pointer to member functions but am running into all types of issues.
How can i go about implementing such a thing
template<class T> class A{
void (T::*callBackFunction)(int);
public:
void addCallBack(void (T::*callBackFunction)(int)){
void (T::*callBackFunction)(int) = &callBackFunction;
}
void performCallBack(){ //I want this to activate the specified function in class B
callBackFunction(3);
}
};
Class B{
A<B> a1;
A<B> a2;
B(){
a1.addCallBack(&a1CallBack);
a2.addCallBack(&a2CallBack);
}
void a1CallBack(int i){
// do stuff
}
void a2CallBack(int i){
// do stuff
}
};