重载运算符与一般函数的比较-C++程序设计

重载运算符与一般函数的比较:相同:
1)均为类的成员函数;
2)实现同一功能
```cpp
type A {
int i;
}
void AddA(A &a, A &b) { a.i = b.i + 3; }
A operator+(const A& lhs, const A& rhs) { return A{lhs.i + rhs.i}; }
// 使用重载运算符
A result = obj1 + obj2;
AddA(obj1, obj2); // 等价于 obj1.AddA(obj2);
```
ppt 文件大小:8.66MB