- 6
What is the keyword for overloading an operator in C++?
What is the keyword for overloading an operator in C++? Quis Module C++
4 Respuestas
+ 1
Syntax (example of + overloading):
className operator+(className &obj) { }
className operator<op>(className &obj) { }
I think the answer is already in your question.
Please review your lessons if you are confused, or you can just check the comment sections in that quiz to get help from the community in that course, way easier.
+ 1
You just have to write operator@ (where @ is the operator you want to overload) as name of the overloading function
+ 1
Here's a complete example by John Wells sir. Includes links to examples in other languages.
https://code.sololearn.com/cStdw0OPtPxG/?ref=app