我想重载我的操作符它真的只是一个类,它包含算术函数和一个数组变量序列。二进制'*':没有找到全局运算符,它需要类型'统计'(或没有可接受的转换)
但是当我我的过载(*)乘法算我得到这个错误:
binary '*' : no global operator found which takes type 'statistician'
(or there is no acceptable conversion)
这发生在我的代码试图做的事:s = 2*u;
在main.cpp中
其中s和u是统计学课程。
统计学家=我的课
(statistician.h)
class statistician
{
... other functions & variables...
const statistician statistician::operator*(const statistician &other) const;
..... more overloads...
};
任何帮助将是真棒谢谢!