Ejemplo n.º 1
0
        static void Lesson10()
        {
            PlayerCar playerCar = new PlayerCar("SportCar", 10, 100);

            Console.WriteLine($"Player car Start position:");
            playerCar.PrintCurrentPosition();
            EnemyCar enemyCar = new EnemyCar("BigBoss", 15, 200);

            Console.WriteLine($"Enemy car Start position:");
            enemyCar.PrintCurrentPosition();

            playerCar.position.movePosition(1, 1);
            enemyCar.position.movePosition(2, 2);

            Console.WriteLine($"Player car:");
            playerCar.PrintCurrentPosition();
            Console.WriteLine($"Enemy car:");
            enemyCar.PrintCurrentPosition();
        }
Ejemplo n.º 2
0
        static void Lesson13()
        {
            PlayerCar pcar = new PlayerCar("car1", 1, 100);

            pcar.PrintCurrentPosition();
            pcar.position.PrintCurrentPosition();
            EnemyCar enCar = new EnemyCar("enemyCar", 1, 222);

            enCar.PrintCurrentPosition();
            enCar.position.PrintCurrentPosition();

            Car newCar = (Car)pcar;

            newCar.PrintCurrentPosition();
            newCar.position.PrintCurrentPosition();
        }