5. Overdefinition of operators
C++ lets you over-define existing operators, i.e. give them a new meaning when they relate (in whole or in part) to objects of class type.
To override an existing operator op, define a function named operator op (you can put one or more spaces between the word operator and the operator, but you don't have to):
In the first case, if op is a binary operator, the notation a op b is equivalent to :
Example
operator op (a, b)
In the second...
You do not have access to this resource.
Exclusive to subscribers. 97% yet to be discovered!
Already subscribed?
Log in!
Ongoing reading
Overdefinition of operators