在Java中从派生类调用基类构造函数
我的课程如下:
public class Polygon extends Shape{
private int noSides;
private int lenghts[];
public Polygon(int id,Point center,int noSides,int lengths[]) {
super(id, center);
this.noSides = noSides;
this.lenghts = lengths;
}
}
正多边形是所有边都相等的多边形。正多边形的构造器应该是什么
public Regularpolygon extends Polygon{
//constructor ???
}
# 1 楼答案
你的构造函数应该是