Exemple #1
0
        static void Main(string[] args)
        {
            LiskovFailure.Apple apple = new LiskovFailure.Orange();
            Console.WriteLine("Without Implementing Liskov:" + apple.GetColor());
            apple = new LiskovFailure.Apple();
            Console.WriteLine("Without Implementing Liskov:" + apple.GetColor());

            Console.WriteLine("Implementing Liskov");
            Fruit fruit = new Orange();

            Console.WriteLine(fruit.GetColor());
            fruit = new Apple();
            Console.WriteLine(fruit.GetColor());
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Fruit fruit = new Orange();

            Console.WriteLine(fruit.GetColor());

            //IWorker worker = new Person();

            //worker.Eat();
            //worker.Sleep();

            //IWorker robot = new Robot();

            //robot.Work();
            //robot.Sleep();
        }