1:是俩个构造函数么?2:public Point(int xx,int yy){setPoint(xx,yy);}是什么意识啊?class Point{protected int x,y;public Point(){}public Point(int xx,int yy){setPoint(xx,yy);}public void setPoint(int m,int n){x=m;y=n;}public int getX(){r
来源:学生作业帮助网 编辑:六六作业网 时间:2024/09/04 10:49:29
1:是俩个构造函数么?2:public Point(int xx,int yy){setPoint(xx,yy);}是什么意识啊?class Point{protected int x,y;public Point(){}public Point(int xx,int yy){setPoint(xx,yy);}public void setPoint(int m,int n){x=m;y=n;}public int getX(){r
1:是俩个构造函数么?2:public Point(int xx,int yy){setPoint(xx,yy);}是什么意识啊?
class Point{
protected int x,y;
public Point(){}
public Point(int xx,int yy){setPoint(xx,yy);}
public void setPoint(int m,int n){x=m;y=n;}
public int getX(){return x;}
public int getY(){return y;}
}
我的意思是,为什么要定义成(int xx,int yy)而不是(int x,int y)
1:是俩个构造函数么?2:public Point(int xx,int yy){setPoint(xx,yy);}是什么意识啊?class Point{protected int x,y;public Point(){}public Point(int xx,int yy){setPoint(xx,yy);}public void setPoint(int m,int n){x=m;y=n;}public int getX(){r
是2个构造函数.一个默认的不带参.一个带参.
带参的接受2个参数.在调用setPoint给x,y赋值