Skip to content

Instantly share code, notes, and snippets.

@d630
Last active July 13, 2018 02:18
Show Gist options
  • Save d630/68dcfc707621e683e390a09c75290246 to your computer and use it in GitHub Desktop.
Save d630/68dcfc707621e683e390a09c75290246 to your computer and use it in GitHub Desktop.
Tag 11: Flugzeuge
namespace csharp
{
public class Flugzeug
{
private string hersteller;
private int maxSpeed;
private string immatNum;
private int anzahlFluegel = 1;
private const int LOOPINGSPEED = 320;
public Flugzeug(string hersteller, int maxSpeed, int anzahlFluegel)
{
this.hersteller = hersteller;
this.maxSpeed = maxSpeed;
this.anzahlFluegel = anzahlFluegel;
}
public string ImmatNum { get; set; }
public virtual bool getLooping()
{
return this.maxSpeed > LOOPINGSPEED;
}
}
public class Verkehrsflugzeug : Flugzeug
{
private int anzahlPassagiere;
public Verkehrsflugzeug(string hersteller, int maxSpeed, string immatNum, int anzahlPassagiere) : base(hersteller, maxSpeed, 1)
{
this.anzahlPassagiere = anzahlPassagiere;
base.ImmatNum = immatNum;
}
public int getAnzahlPassagiere()
{
return this.anzahlPassagiere;
}
public void setAnzahlPassagiere(int anzahlPassagiere)
{
this.anzahlPassagiere = anzahlPassagiere;
}
public override sealed bool getLooping()
{
return false;
}
}
public class Doppeldecker : Flugzeug
{
private readonly bool offenesCockpit;
public Doppeldecker(string hersteller,int maxSpeed,string immatNum, bool offenesCockpit) : base(hersteller, maxSpeed, 2)
{
this.offenesCockpit = offenesCockpit;
}
public Doppeldecker(string hersteller, int maxSpeed, string immatNum) : base(hersteller, maxSpeed, 2)
{
this.offenesCockpit = true;
}
public bool isOffenesCockpit()
{
return this.offenesCockpit;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment