Exemplo n.º 1
0
        static void MainOld(string[] args)
        {
            Printer p  = new Printer();
            Printer p2 = new SecondPrinter();

            Printer.Test(p);
            Printer.Test(p2);
            Message mes = p.Method;
        }
Exemplo n.º 2
0
 public static void Test(Printer p)
 {
     Console.WriteLine(p.GetType() + ": " + p.field + " " + p.prop + " " + p.Property + " " + p.Method() + " " + p.Method2());
     if (p is SecondPrinter)
     {
         SecondPrinter p2 = (SecondPrinter)p;
         Console.WriteLine(p2.GetType() + ": " + p2.field + " " + p2.prop + " " + p2.Property + " " + p2.Method() + " " + p2.Method2());
     }
 }