Ejemplo n.º 1
0
 public FahrzeugControl(CFahrzeug fahrzeug)
 {
     InitializeComponent();
     this.fahrzeug = fahrzeug;
     Farbe         = fahrzeug.Farbe;
     if (fahrzeug.GetType() == typeof(CFahrrad))
     {
         lblTacho.Visible = false;
         btnGas.Text      = "Treten";
         btnHupe.Text     = "Klingel";
     }
 }
Ejemplo n.º 2
0
 private void btnHupe_Click(object sender, EventArgs e)
 {
     if (fahrzeug.GetType() == typeof(CAuto))
     {
         //CAuto auto = (CAuto)fahrzeug;
         //auto.Hupen();
         ((CAuto)fahrzeug).Hupen();
     }
     else
     {
         ((CFahrrad)fahrzeug).Klingeln();
     }
 }