我对类和子类的构造函数(扩展第一个类)有问题
这是基本类的构造函数:
public Airplane(int x, int y, int width)
{
this.x = x;
this.y = y;
this.width = width;
createSeats();
}
这是另一个类的构造函数,它扩展了基本类
public Boeing(int x, int y, int width)
{
super(x,y,width);
createSeats();
}
问题是这createSeats()
是两个类中的另一种方法,但Boeing
必须覆盖主要方法。我怎样才能使它能够在不采取该createSeats()
方法的情况下工作?