在c++中,为什么我们必须重载+=,-=,+,-操作符,除了重载+和-运算符?下面是一个示例:class Point { int x, y; Point(int X, intoperator-(Point a) { return Point(x - a.x, y - a.y); }但是在C#这样的其他语言中,我们不需要重载+=和-=操作符:
public classPoint(
我知道在C++中你可以像重载函数一样重载一个运算符。与C++中的函数一样,您必须指定一个返回值:在这里,我将operator+作为一个返回int的函数重载。但是我发现当我重载一个类型并给它一个返回值时,我得到了error: return type specified for 'operator int'。struct A {
v
我有一个重载+、-、*运算符并将它们导出到.DLL文件中的C++代码。现在,我想从VB.NET代码中导入这些重载操作符。所以它应该是这样的: Operator +(ByVal a1 As A, ByVal a2<DllImport("StructDLL.dll")> Public Shared
Operator +(ByVal