我创建了代表线的类,aX + bY = c
我希望重载+
运算符提高线(返回更高的线,所以我在下面做了,但编译器说invalid use of this
class Linia{
public:
double a,b,c;
Linia (double a, double b, double c){
this->a = a;
this->b = b;
this->c = c;
}
friend Linia operator+ (double i){
return new Linia(a, this->b, this->c + i/this->b);
}
};
我想返回Linia
具有如上所示字段的新对象i
是int
我不想修改原始对象