private void btnStrategy_Click(object sender, EventArgs e) { Jet jet = new Jet(); jet.SetAlgorithm(new GoByDrivingAlgorithm()); jet.go(); jet.SetAlgorithm(new GoByFlyingAlgorithm()); jet.go(); jet.SetAlgorithm(new GoByFlyingFastAlgorithm()); jet.go(); }
private void btnDemo_Click(object sender, EventArgs e) { try { StreetRacer streetRacer = new StreetRacer(); FormulaOne formulaOne = new FormulaOne(); Helicopter helicopter = new Helicopter(); Jet jet = new Jet(); //call streetRacer.go(); formulaOne.go(); helicopter.go(); jet.go(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }