Objektorientierung/Auto.java

20 lines
358 B
Java

class Auto extends Fahrzeug
{
public Auto(){
super(4);
}
public double getMaxSpeed(){
return 140;
}
public String toString(){
if (! (this instanceof Krankenwagen || this instanceof Rennwagen)){
return "Das Auto" + super.toString();
}
return super.toString();
}
}