Example #1
0
        public static void Main()
        {
            string name = Console.ReadLine();
            var    car  = new Ferrari(name);

            Console.WriteLine(car.ToString());

            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");
            }
        }
Example #2
0
        public static void Main()
        {
            var driver  = Console.ReadLine();
            var ferrari = new Ferrari(driver);

            Console.WriteLine(ferrari.ToString());

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

            bool isCreated = typeof(ICar).IsInterface;

            if (!isCreated)
            {
                throw new Exception("No interface ICar was created");
            }
        }
Example #3
0
        static void Main(string[] args)
        {
            string  model      = "488-Spider";
            string  driverName = Console.ReadLine();
            Ferrari ferrari    = new Ferrari(model, driverName);

            Console.WriteLine(ferrari.ToString());

            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");
            }
        }
Example #4
0
        static void Main(string[] args)
        {
            IDriveable car = new Ferrari(Console.ReadLine());

            Console.WriteLine(car.ToString());
        }