Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  template function in class in C++

We can define template function in a class, but one thing we should pay attention to is that the member function template definition (in addition to the declaration) should be in the header file, not the cpp, though it does not have to be in the body of the class declaration itself.Example //Sorter.h#pragma onceclass Sorter{public:    Sorter(void);    ~Sorter(void);    template <class type> static void qsort(type arr[],int start,int end);};template <class type> static void Sorter::qsort(type arr[],int start,int end){    in...

2,603 0       C++ TEMPLATE FUNCTION CLASS DEFINITION D