阅读背景:

如何重载运算符以使左/右类型无关紧要?

来源:互联网 

A simple example - I want to have a point class that describes a point in 2 dimensions. And I want to be able to add two points together... as well as multiply two points together (don't ask me why), or multiply a point by a scalar. For right now, I'll only implement it as if the scalar is an integer but fraction or floats is also trivial to do.A simple example - I want to have a point class




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: