作业帮 > 综合 > 作业

cannot convert from 'const class Line' to 'class Line

来源:学生作业帮 编辑:百度作业网作业帮 分类:综合作业 时间:2024/07/19 06:34:30
cannot convert from 'const class Line' to 'class Line
#include
using namespace std;
class Point{
private:
\x09double xx,yy;
\x09friend class Line;
public:
\x09Point(double a=0,double b=0){
\x09\x09xx=a;
\x09\x09yy=b;
\x09\x09cout
cannot convert from 'const class Line' to 'class Line
Line& start() const {return (*this);};应该写成const Line& start() const {return (*this);};
常量方法返回值必须是常量,否则我们就可以获得对常量的修改权,这就矛盾了.