InterviewSolution
Saved Bookmarks
| 1. |
For overloading “( )”, “[ ]” or “->” operators, a class __________(a) Must use static member functions(b) Must use non-static member functions(c) Must be non-static member and should not be friend of class(d) Must use static member function or a friend member function |
|
Answer» The correct answer is (c) Must be non-static member and should not be friend of class To explain I would say: For overloading those operators for a class, the class must use non-static member function so that doesn’t remain common to all the objects, and each object can use it independently. The friend functions is also restricted so as to keep the security of data. |
|