Templates in C++

A technique quite frequently employed in Object Oriented Paradigm and otherwise is known as Generic Programming. Generic Programming is a concept using which you a user can write a code which works well for many data types. In other words, it is type independent programming. A function made generic does not need to know what kind of data type it is receiving. Generic programming is made possible through a feature known as templates. Templates allow functions and classes to operate with these generic or types. I shall explain you why we need templates and how do we employ them.