Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2
A template is an abstract description of a function or a class that requires one or multiple compile time parameter(s) in order to form a complete function or class. The parameters are usually a type or an integer. Minimum example for a template class: template<typename T> class A {}; Note: class template As template parameter T is unused in the definition of the class. Usually one would use it of course. Far more complex examples for class templates are the containers in the standard library (e.g. vector, list etc.) The template parameter T must be filled in to form a complete class from the class template A: A<float> a1; A<78> a2;
27th Oct 2016, 11:50 PM
Stefan
Stefan - avatar