1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
   |  
typedef bool (* Ptr_Func_t) (int start, int end);
 
class c
{
public:
  void fc1(int start, int length, Ptr_Func_t Func)
  {
    if (Func(start, start+length-1)) printf("début > fin\n");
  }
};
 
class a
{
public:
  bool fa1(int start, int end) { return (start>end); }
 
  void fa2(void) { c obj; obj.fc1(10,10,(Ptr_Func_t) &a::fa1); }
};
 
class b
{
public:
  bool fb1(int start, int end) { return (start>end); }
 
  void fb2(void) { c obj; obj.fc1(10,10,(Ptr_Func_t) &b::fb1); }
}; | 
Partager