Link to home
Start Free TrialLog in
Avatar of cyogesh
cyogesh

asked on

template class

hi,
Why do we include the template class implementation file in header file?

Avatar of Zizzer
Zizzer

Because the implementation is necessary at compile-time in order to instantiate the template.  For example, in order to instantiate list<MyClass>, the implementation of the list template is needed by the compiler (e.g. in order to determine the size of the nodes in the linked list).

-- Zizzer
ASKER CERTIFIED SOLUTION
Avatar of KangaRoo
KangaRoo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial