Computer Science - Object Oriented Programming Using C++ - Discussion

Discussion Forum : Object Oriented Programming Using C++ - Section 1 (Q.No. 23)
23.
The generic type in a template function
must be T
can be T
cannot be T for functions you create, but may be for C++'s built-in functions
cannot be T
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
6 comments Page 1 of 1.

Jasminder Singh said:   1 year ago
Generics allow programmers to write a function that can take any type of anrugments.

Example : T sum(T a, T b) {
return a+ b;
}

The sum function can take any type of data like string, integer, even, char, or float etc. We don't need to explicitly define the return type and paramerter type.

Udayashokkumar.nunna said:   1 decade ago
T indicates here generic data type there is necessary instead of declaring any data type for eg: function(Ta,Tb).we can use function(int a,int b), function(a,b),function(char a,char b)

Lakhan Ghayade said:   5 years ago
Generic is the idea to allow data types like int, char, string Or user defined types. Etc. To be in the methode, class, Or interfaces.

Lakhan Ghayade said:   5 years ago
In short, for any particular function using T as a datatype, can use any datatype as an argument.

Divya said:   8 years ago
Generic data type means?

Harpreet said:   1 decade ago
Please explain this.

Post your comments here:

Your comments will be displayed after verification.