# Include <stdio. h>
Class someclass {
Public:
Void some_member_func (int x, char * P ){
Printf ("in someclass ");};
};
Class derivedclass: Public someclass {
Public:
// If you uncomment the next line, the code at line (*) will fail!
// Void some_member_func (int x, char * P) {printf ("in derivedclass ");};
};
Int main (){
// Declare a member function pointer for someclass
Typedef void (someclass: * someclassmfp) (INT, char *);
Someclassmfp my_memfunc_ptr;
My_memfunc_ptr = & derivedclass: some_member_func; // ---- line (*)
Derivedclass * DC;
DC-> * my_memfunc_ptr (1 ,"");
}
# Include <stdio. h>
Struct X {
Int Foo () {return 0 ;}
} X;
Struct y
{
Static int (X: * p )();
};
INT (X: * Y: p) () = & X: Foo;
Int main (INT argc, char * argv [])
{
Printf ("Hello, world \ n ");
(X. * Y: p )();
// (X-> * Y: p )();
// (Y: p) (X );
// (Y: X. * p )();
// (X. y: p )();
Return 0;
}