hi i was going through Functor tutorial on net which had the following example
Code:
class TFunctor
   {
   public:
      virtual void operator()(const char* string)=0;
      virtual void Call(const char* string)=0;
 };

   template <class TClass> class TSpecificFunctor : public TFunctor
   {
   private:
      void (TClass::*fpt)(const char*);
      TClass* pt2Object;

   public:
      TSpecificFunctor(TClass* _pt2Object, void(TClass::*_fpt)(const char*))
         { pt2Object = _pt2Object;  fpt=_fpt; };

      virtual void operator()(const char* string)
       { (*pt2Object.*fpt)(string);};              // execute member function

      virtual void Call(const char* string)
        { (*pt2Object.*fpt)(string);};             // execute member function
   };

Code:
class TClassA{
   public:

      TClassA(){};
      void Display(const char* text) { cout << text << endl; };

      /* more of TClassA */
   };

   // dummy class B
   class TClassB{
   public:

      TClassB(){};
      void Display(const char* text) { cout << text << endl; };

      /* more of TClassB */
   };


   // main program
   int main(int /*argc*/, char* /*argv[]*/)
   {
      // 1. instantiate objects of TClassA and TClassB
      TClassA objA;
      TClassB objB;

  TSpecificFunctor<TClassA> specFuncA(&objA, &TClassA::Display);
  TSpecificFunctor<TClassB> specFuncB(&objB, &TClassB::Display);
  TFunctor* vTable[] = { &specFuncA, &specFuncB };
  vTable[0]->Call("TClassA::Display called!");        // via function "Call"
  (*vTable[1])   ("TClassB::Display called!");        // via operator "()"
   cout << endl << "Hit Enter to terminate!" << endl;
   cin.get();
   return 0;
   }

Now i tried to replace main() with a class
Code:
class test
{
public:
TClassA objA;
This is not possible now
Code:
TSpecificFunctor<TClassA> specFuncA(&objA, &TClassA::Display);
};
How to achieve this when main() is removed.