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;}}class Circle extends point{private double radius;public

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/19 23:06:29
classPoint{protectedintx,y;publicPoint(){}publicPoint(intxx,intyy){setPoint(xx,yy);}publicvoidsetPoi

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;}}class Circle extends point{private double radius;public
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;}}
class Circle extends point{
private double radius;
public Circle(int x,int y,double r){this.x=x;this.y=y;steRadius(r);}
public void setRadius(double r){radius=r;}
public double getRadius(){retuen radius;}
public double getArea(){retuen 3.1415*radius*radius;}
public String toString()
{
retuen "Poistion("+x+","+y+")Radius="radius;}}
public class CircleTest
{
public static void main(String args[]){
Circle c=new Circle(50,50,10);
System.out.prinrln(c.toString());
c.setPoint(100,100);
c.setRadius(20);
System.out.println(c.toString());
}}
1:父类的public Point(){}构造方法为什么不能省略,它是初始化谁的?
2:父类的public Point(int xx,int yy){setPoint(xx,yy);}构造方法是初始化谁的?为什么形参是(xx,yy)而不是(g,h)?

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;}}class Circle extends point{private double radius;public
1.子类构造函数一般要调用父类的构造函数;当子类没有显式调用时,默认调用父类的无参构造函数,此时要是没有父类的无参构造函数,会出错.
2.父类的public Point(int xx,int yy){setPoint(xx,yy);}是设置成员变量x,y的值,形参是什么无所谓
不建议构造函数这样写;一般应该这样写:
public Point (int x,int y) { this.x=x; this.y=y }
public setX (int x) { this.x=x; }
public setY( int y) { this.y=y; }
public int getX() { return this.x; }
public int getY() { return this.y; }

protect protect protect c++代码,#include using namespace std; //声明class Point;Point operator+(Point &a,Point &b);//定义点类class Point { public:int x,y; Point(){}Point(int xx,int yy){x=xx;y=yy;}void print(){ cout I just want to find a mature point to protect me is this also is wrong What is your class rank and your grade point?啥意思啊What is grade point? java由三点求三角形的周长public class Point {int x;int y;Point(){ }Point(int a,int b){x=a;y=b;}}public class Triangle {Point n1,n2,n3;Triangle(Point n1,Point n2,Point n3){n1=new Point();n2=new Point();n3=new Point();}double x1=Math.pow(n1.x- point point point I just want to find a mature point to protect me is this also is wrong这句话怎么翻译? class Point{ private double x; private double y; Point(double x1,double y1){ x=x1; y=y1; } public Point::Point(Point & He is one point four metres tall and sits in the front rowof class.怎么翻译? 请各位大神帮我看看这个指针到底哪里出错了?#include#includeusing namespace std;class point{public:point();point(int xx,int yy){x=xx;y=yy;}point();int getx(){return x;}private:int x,y;};int main(){point *p=new point;point a(2,3);p=&a c++ 求三角形周长和面积#include#include using namespace std;class Point{public:Point(double xx=0 ,double yy=0 ){x =xx;y=yy;}Point(Point&p);double getX(){return x ;}double getY(){return y;}private:double x,y;};Point::Point(Point&p){x=p.x;y=p.y protect 造句protect 造句 英语翻译However bad Tom and Daisy's marrige is,they protect each other,even to the point where others pay for their mess.① the point怎么理解②where怎么出来的?