Content deleted Content added
m clarify |
m →Operator methods: Improve C++ example |
||
Line 108:
Operator methods [[Operator overloading|define or redefine operator symbols]] and define the operations to be performed with the symbol and the associated method parameters. C++ Example:
<syntaxhighlight lang="cpp">
#include <string>
class data▼
public:
bool operator<(const Data& data) const { return roll_ < data.roll_; }
int roll;▼
return name_ == data.name_ && roll_ == data.roll_;
}
private:
std::string name_;
};
</syntaxhighlight>
|