【发布时间】:2022-01-06 00:29:45
【问题描述】:
我有这门课:
class Vehicle {
private:
char dir_;
public:
char car_;
// functions
//
// overloaded operators
bool operator==(Vehicle&);
bool operator<(const Vehicle& v);
//
// other functions
};
有这个实现:
bool Vehicle::operator<(const Vehicle& v) {
return (car_ < v.car_);
}
我收到了这个错误: “'operator
在“stl_funxtion.h”中
【问题讨论】:
-
你需要声明
operator<const -
请显示minimal reproducible example。不知道你是如何在“stl_function.h”中得到错误的。