static void Main(string[] args) { Console.WriteLine("***** Fun with Class Types *****\n"); // Make a Car called Chuck going 10 MPH. Car chuck = new Car(); chuck.PrintState(); // Make a Car called Mary going 0 MPH. Car mary = new Car("Mary"); mary.PrintState(); // Make a Car called Daisy going 75 MPH. Car daisy = new Car("Daisy", 75); daisy.PrintState(); }
static void Main(string[] args) { Console.WriteLine("Конструктор по умолчанию"); Car myCar = new Car(); for (int i = 0; i <= 10; i++) { myCar.SpeedUp(5); myCar.PrintState(); } Console.WriteLine("\n\nКонструктор с параметрами"); myCar = new Car("Рубенс Барикелло"); for (int i = 0; i <= 10; i++) { myCar.SpeedUp(5); myCar.PrintState(); } }