void cStyleFunction(int param){...}
class Aclass {
void classFunction(int param){...}
static void classStaticFunction(int param){...}
};
namespace NameSpace{
void namespaceFunction(int param){...}
}
void (*FunctionPointer) (int param);
typedef void (*TypedefFunctionPointer) (int param);
void (Aclass::*ClassFunctionPointer) (int param);
void (*FunctionPointer) (int param);
void main(){
void (*FunctionPointer) (int param);
FunctionPointer = cStyleFunction; //ok
FunctionPointer = Aclass::classStaticFunction; //ok
FunctionPointer = NameSpace::namespaceFunction; //ok
FunctionPointer = Aclass::classFunction; //error
FunctionPointer(param);
}
typedef void (*TypedefFunctionPointer) (int param);
typedef void (*TypedefFunctionPointer) (int param);
void main(){
TypedefFunctionPointer tfp;
tfp = cStyleFunction; //ok
tfp = Aclass::classStaticFunction; //ok
tfp = NameSpace::namespaceFunction; //ok
tfp = Aclass::classFunction; //error
tfp(param);
}
typedef void (Aclass::*ClassFunctionPointer) (int param);
void main(){
Aclass *a = new Aclass();
void (Aclass::*ClassFunctionPointer) (int param);
ClassFunctionPointer = &Aclass::classFunction; //ok
(a->*ClassFunctionPointer)(param);
}
0 개의 댓글:
댓글 쓰기