static void Main(string[] args)
    {
        DoSomething worker = new InsultMe();

        worker.whatToDo();
        worker = new InspireMe();
        worker.whatToDo();
    }
Exemplo n.º 2
0
    static void Main(string[] args)
    {
        DoSomething worker = new InsultMe();

        worker.DoWhateverItIsThatIDo();
        worker = new InspireMe();
        worker.DoWhateverItIsThatIDo();
        // In this case base class method is invoked
        worker = new DoWhatBaseClassDoes();
        worker.DoWhateverItIsThatIDo();
    }