Lecture 5 - Slide 33 : 40
Example - Point<C>
We make a type parameterized Point - class
A modest first example...
A type parameterized variant of class Point - point.h.
The implementation of the template class Point - point.cc.
A program that illustrate template instantiation.
A program that illustrate problematic template instantiation.
Compiler errors for the program from above - typical for compilation of template instances with errors.
The definition of member functions in the template class becomes more complex
See the file
Template instantiation first occurs when
For this reason,
must be included in
instead of (as usual)
Compiler error messages from instances of templates are difficult to deal with
It is attractive to provide error messages at a higher level
A template class with friends