示例#1
0
        static void Main(string[] args)
        {
            var nameDriver = Console.ReadLine();
            var car        = new Ferrari("488-Spider", nameDriver);

            Console.WriteLine($"{car.Model}/{car.UseBrakes()}/{car.GasPedal()}/{car.Driver}");

            string ferrariName       = typeof(Ferrari).Name;
            string iCarInterfaceName = typeof(ICar).Name;

            bool isCreated = typeof(ICar).IsInterface;

            if (!isCreated)
            {
                throw new Exception("No interface ICar was created");
            }
        }
示例#2
0
        public static void Main()
        {
            var driver = Console.ReadLine();
            var car    = new Ferrari(driver);

            Console.WriteLine($"{car.Model}/{car.Brakes()}/{car.Gas()}/{car.DriverName}");

            string ferrariName       = typeof(Ferrari).Name;
            string iCarInterfaceName = typeof(ICar).Name;

            bool isCreated = typeof(ICar).IsInterface;

            if (!isCreated)
            {
                throw new Exception("No interface ICar was created");
            }
        }