Example & Tutorial understanding programming in easy ways.

What is class template in C++ ?

Class template :


-A class template is used to create a family of classes and functions.

For example -

we can create a template of an array class which will enable us to create an array of various types such as int, float, char, etc. 

-Similarly, we can create a template for a function, suppose we have a function add(), then we can create multiple versions of add(). 

The syntax of a class template: 

template<class T> 

class classname 

// body of class; 

}; 

Syntax of a object of a template class: 

classname<type> objectname(arglist);

Read More →
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!