cannot convert from 'const class Line' to 'class Line#includeusing 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

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/17 21:35:23
cannotconvertfrom''constclassLine''to''classLine#includeusingnamespacestd;classPoint{private:\x09double

cannot convert from 'const class Line' to 'class Line#includeusing 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
#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#includeusing 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
Line& start() const {return (*this);};应该写成const Line& start() const {return (*this);};
常量方法返回值必须是常量,否则我们就可以获得对常量的修改权,这就矛盾了.