好了,算了。最初的问题应该是“如何在新类中使用或实现”,因为我已经知道如何使用ARX中定义的类
要在类中实现这一点,必须将成员函数转换为非成员函数,因此将其定义为友元函数,从而使其具有全局作用域。
- class Stuff
- {
- public:
- Stuff operator+(int nCount) { ... }
- friend
- Stuff & operator+(int nCount, const Stuff & stuff) { ... }
- friend
- Stuff & operator+(AcGePoint2d & pt, Stuff & stuff) { ... }
- const Stuff & operator=(const Stuff &vec) { ... }
- };
- Stuff st = Stuff() + 4;
- st = 4 + Stuff();
- st = AcGePoint2d(10,10) + Stuff();
|