java编程 继承关系
class Transport {
public Transport() {
}
}
class Bus extends Transport {
private String busName;
public Bus(String busName) {
this.busName = busName;
}
}
class Train extends Transport {
private String trainName;
private double trainSpeed;
public Train(String trainName, double trainSpeed) {
this.trainName = trainName;
this.trainSpeed = trainSpeed;
}
}
class Airplane extends Transport {
private String airplaneName;
private double airplaneSpeed;
private String Voyage;
public Airplane(String airplaneName, double airplaneSpeed, String Voyage) {
this.airplaneName = airplaneName;
this.airplaneSpeed = airplaneSpeed;
this.Voyage = Voyage;
}
}