Computer Science, asked by iqbalnasir3289, 1 year ago

Write a note on class templates.

Answers

Answered by abrarofficial
0

A class template provides a specification for generating classes based on parameters.

They are generally used to implement containers.

Example:

template <class T>

class MyTemplate {

T element ;

public:

MyTemplate ( T arg ) { element= arg;}

T divideBy2 ( ) { return element/2 }

} ;

Similar questions