Function templates are considered equivalent - Function and Method

Q.  Function templates are considered equivalent when
- Published on 19 Oct 15

a. Declared in same scope
b. Having same name
c. Having identical return type and parameter list
d. All of the above

ANSWER: All of the above
 
Function overloading performs similar operations on different data types. Thus if similar operations are to be executed on all data types, function templates gives an easy solution for the same. Function template is defined with keyword 'template' followed by a parameter list. Each parameter has typename and can be of built-in or user defined type. Also, the number of parameters must not exceed eight. All the given options in the question above are hence true.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)