Breaking News

Introduction of Templates In C++

Templates are the mechanism that make it possible to use one function or class to handle many different data types.
 
A template can be used to create the family of classes or functions.
 
When template used with the functions are called function templates, when they are used with the classes then they are called class templates.
 
A template can also be considered as a kind of macro.
When an object of a specific type is defined for actual use, the template definition for that class is substituted with the required data type.
 
Since template is defined with a parameter that would be replaced by a specified data type at the time of actual use of the class or function, the templates are sometimes called parameterized classes or function.
 
 

Check Also

Virtual Functions In C++

  Virtual function is a member function of a base class and redefined by a …