public Form1() { InitializeComponent(); Van van = new Van(); Car car = new Car(); Minivan minivan = new Minivan(); Sportscar sportscar = new Sportscar(); van.Drive(); car.Drive(); minivan.Drive(); sportscar.Drive(); }
// Main function for where instructions are placed for computer to execute. static void Main() { Sportscar mustang = new Sportscar("Mustang", 4, "black", 180); if (mustang is Sportscar) { mustang.move(); mustang.stop(); } else { Console.Write($"Cannot drive the {mustang.brand}"); } Console.ReadLine(); }