what are templates?Do templates have more adavatages over polymorphism?
What are templates? Do they have advantages over polymorphism?
Collapse
X
-
Templates and polymrpism are two different things. There is no connection between them.
A template is used when you have the same code used for many types. You replace the type with a parameter. Then when you compile your code, the compiler makes a copy of the template and substitutes the actual type fr the parameter.
Many examples on the web about this.
Comment