The template is a unique feature of the C++ language. A template is an outline or a sketch of a class or a function, which can later be converted to a specific type of a class or function, based on user’s requirement. Whenever the function or a class with specific type is defined, this template is used to generate a copy of a function or a class for that specific type. The idea of template is derived from the need of two different camps. One camp wants to preserve the efficiency of the C language while the other camp demands generic solutions to problems, for example, designing classes which can work with any valid data types and design algorithms which can also work with objects of multiple classes. How templates are able to satisfy requirements of both communities is the theme of this and next module. Templates do everything at compile time and do not leave anything to be done at runtime.
No Reviews found for this course.