it might be strange what i'm trying to see and i will try to clarify as much as possible. I'm using gcc 4.8 on ubuntu 14.04 and C++11.
What i want trying to do is:
- make a class A
- make a function in that class A which gets as argument
- a pointer to a class member of the same class
- make a new class B which inherits from A
- make a new method of class B
give a pointer to that method of class B to a method of parentclass A as argument
class A{
typedef void(A::*METHOD);
void executeMethod(METHOD arg){};
}
class B : A{
void sampleMethod(){};
void childMethod(){
this->executeMethod(&B::sampleMethod); //<== error
}
}
However this brings me the following error in codeblocks:
error: no matching function to call for 'B::executeMethod(void B::*)'
Is there any way around this?
Is there anything else i need to do to make it clear to you, what i'm trying to accomplish?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…