Open main menu

CDOT Wiki β

Changes

C/C++ FAQ

No change in size, 22:42, 10 November 2012
C/C++ FAQ
<br>
*comment (pliu): Could you please post up the source code and the listing of compiler error messages please? <br>
'''A:''' When splitting the deceleration of a template class additional code must be added onto every member method of that class. If one has a class called Stack and a function called add(int x) for example, then in the implementation file the display function would be defined in the scope of the Stack class by writing int Stack::add(int x). Since templates are being used the compiler must also be told that this implementation is being defined with a template. This is done by writing something like template<class T> before every function. For the example stated it would look like this:
template<class T>