Discussion
Which of the following defines a family of functions in the same way a class templates defines as family of classes ?
Answer: A
A family of functions is defined by Function templates.
In C++ a function template, such as a max function written once with a type parameter T, defines a whole family of functions, one for each type it is instantiated with, just as a class template defines a family of classes.
'Generic functions' describes what templates produce but is not the C++ construct. A virtual function supports run-time polymorphism through a base class, and a friend function is a non-member function granted access to a class's private members; neither defines a family of functions.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development