Which C++ operators can not be overloaded at all without friend function?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The operators where the left-hand-side operand is not the class itself. For example
cout << somtethingcan be achieved via defining astd::ostream& operator<<(std::ostream& lhs, Something const & rhs);function, and marking them asfriendinside the class.EDIT: Friending is not needed, ever. But it can make things simpler.