answersLogoWhite

0

Template programming in C++ is the technique of writing a class that handles arbitrary data types instead of specific data types.

For instance, if you had a class that implemented a linked list of integers (int), and you wanted a linked list of floating points (double), you would need to clone the class implementation of list-int and make it list-double, and you would need to modify all the places in the class that pertain to int and change it to double.

Templates, on the other hand, allow you to implement a generic class, say a linked list of <type-t>. Then, when you declare a linked list of double, the compiler creates the class and replaces all <type-t> with double. For this to work correctly, the list portion of the class must be able to reliably perform whatever tests it might need on the type portion of the class without knowing anything about that type. This generally means that all possible relational operators have to be overloaded as needed.

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

What is the different between c and c plusplus?

C is a procedure oriented programming and C++ is a object oriented programming.C++ is a superset of C.


How you describe operations of stack ADT using c template functions?

No, because C does not support the concept of template functions. Template functions only exist in C++, never in C.


What is template in C?

C does not support templates. Templates are supported by C++ and make it possible to write generic code.


What are the Advantages of c over c plus plus?

There are no advantages of C over C++ as such. Everything you can do in C you can also do in C++. However, by taking advantage of C++ object oriented programming, generic programming and template meta programming as well as C-style coding, you can produce more efficient machine code far more easily and more quickly than with C alone.


What can c programming do?

by using this we can write a coding for operating systems


Can we write a c plus plus program without objects?

Since you can create programs in C plus plus (C++) without creating any object you can call the C++ a semi-object-oriented programming language. The C++ programming language was first released in 1983 and it was designed by Bjarne Stroustrup.


What programming language was used to write Windows phone?

Various languages were used to write Windows phone, but primarily C and C++.


How do you write absolute in C programming?

Assuming Absolute Value.abs(num)


Write c programs to display 10 line biodata?

A C++ program can be used to write C programs that will display 10 lines of biodata. Many types of C programming can be written with a C++ program.


How do you write a conclusion on a computer programming assignment?

assignment has been c(_O_)mpleted.


Did Dennis Ritchie write an autobiography?

No. But he was co-author of the book The C Programming Language.


Why wr are using c programming?

C/C++ is used to write system softwares. The whole of UNIX operating system is written in C language.