What defines a general set of operations that is applied to various types of data?

Options
- Template class
- Function template
- Class template
- Both a and c above


CORRECT ANSWER : Function template

Discussion Board
C++ - Templates

The above answer is right. If you need to perform identical operations on various types of data, you use function overloading to create two functions with the required function declaration. However, a better approach would be to use function templates, because you can perform the same task writing less and maintainable code.

Prajakta Pandit 01-23-2017 11:18 PM

Incorrect answer.

Stan is correct. The best answer is "both a and c". However this is a horribly worded question with no entirely correct answer, so I think that's the bigger issue.

The most correct answer is actually "class template" anyway.

Source:
"Working Draft, Standard for Programming Language C++"
Document Number: N4296
Date: 2014-11-19
Revises: N4140

Jeff 06-10-2016 05:37 AM

Incorrect answer to C++ quiz

Because the plural, function templates, is not available, the most suitable answer is "Both a and c" because a class template allows grouping operations on various types of data. A function template is a single function that operates on various types of data.


Stan 08-29-2015 01:09 PM

Write your comments

 
   
 
 

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


Advertisement