Assume the following class declaration template class genCla

Assume the following class declaration: template class genClass {TripleDot char aFunction(TripleDot); TripleDot}; What is wrong with this function definition? char genClass:: aFunction (TripleDot) {TripleDot};

Solution


1. Class genClass is a templated class.
2. aFunction is a memeber function of class genClass


Problem in the function definition is: Function is not defined as templated function.
  
While defining a function as a member of a templated class, it has to be defined as a templated function.  

Rewrite the definition as:
  
   template <typename T>
   char genClass<T>::aFunction(...)   { ... }

 Assume the following class declaration: template class genClass {TripleDot char aFunction(TripleDot); TripleDot}; What is wrong with this function definition?

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site