Ejemplo n.º 1
0
      public static void InheritanceTest01()
      {
          TestCls  cls  = new TestCls();
          TestCls2 cls2 = new TestCls2();

          Console.WriteLine("Test invoking from sub type...");
          Console.WriteLine(cls.ToString());
          cls.TestAbstract();
          cls.TestVirtual();
          cls.TestField();

          Console.WriteLine(cls2.ToString());
          cls2.TestAbstract();
          cls2.TestVirtual();
          cls2.TestField();

          Console.WriteLine("----------------------------------");


          Console.WriteLine("----------------------------------");

          Test01Sub(cls);
          Test01Sub(cls2);

          Console.WriteLine("TestCls.TestVal2 = " + cls.TestVal2);


          ClassInheritanceTest.Test3(cls);
          ClassInheritanceTest.Test3(cls2);
      }