Which operator must be overloaded as a non-static member function in C++?
Correct answer A. operator= (assignment)
Explanation
The assignment operator =, along with subscript [], function call () and member access ->, must be overloaded as non-static member functions (C++23 relaxes this for () and [] only to allow static members). operator+, operator== and operator<< can be either members or free functions, and free functions are often preferred for symmetric binary operators.
Answer checked How we write and check questions
Discussion