1.

What are functors in C++?(a) Objects of a class which are treated as functions(b) Objects that are used to call the function of other classes(c) Functions that are called using pointer objects(d) Functions that are called only once in a programThis question was posed to me during an interview for a job.The origin of the question is Functors topic in portion Algorithms, Objects & Iterators in C++ of C++

Answer»

Correct choice is (a) Objects of a class which are treated as functions

Explanation: FUNCTORS are objects of a class that are treated like function i.e. they can ALSO be USED as function calls.



Discussion

No Comment Found

Related InterviewSolutions