【发布时间】:2020-01-28 09:03:26
【问题描述】:
很抱歉问了以前有人问过的类似问题,但我无法理解答案。
头文件
float Dot(const Point& other) const;
CPP
Point Point::operator*(float operand) const
{
return Point(mX * operand, mY * operand);
}
我收到错误 C2677: binary '*': no global operator found
有什么问题??
【问题讨论】:
-
Dot和Point::operator*有什么关系?请发帖minimal reproducible example。 -
你有点和点,它们是什么关系? mX 和 mY 是从哪里来的?
-
另外,这只是错误消息的一部分。
-
请提供显示此问题的最小完整(可编译)源代码 sn-p。您可以将其发布到例如coliru.stacked-crooked.com 或 godbolt.org 或类似网站。
-
不,那些在线编译器很好,但 SO 指南要求问题中包含相关信息。作为新用户,也请带上tour阅读How to Ask。