Hi all:

I tried to define a template class which contains a member function. This member function has an argument whose type is the typename T.
Code:
template <typename T1>
class A
{
public:
  A() {}
 ~A() {}

  void memFunction( T1 arg1 )
  {
     // if arg1 is not a pointer, then implement the following line
      arg1.itsMemberFunc();
     // If arg1 is a pointer, then implement this line
      arg1->itsMemberFunc();
  }
};
In an application, I will apply the template and the member function.
Code:
int main()
{
  A<AnotherClass> aDouble;
  AnotherClass var1;
  aDouble.memFunction( var1 );

  A<AnotherClass*> anotherClass;
  AnotherClass* var2 = new AnotherClass;
  anotherClass.memFunction( var2 );

  return 0;
}
You may have found that the template won't be compiled as for the line
aDouble.memFunction( var1 ); in main(), "arg1->" can't be recoginised.

So how can I solve this problem? THank you very much.