コード例 #1
0
        public static void Sealed_Classes_and_Methods()
        {
            NormalBase    nb  = new NormalBase();
            SealedDerive  sd  = new SealedDerive();
            SealedDerive1 sd1 = new SealedDerive1();
            SealedDerive2 sd2 = new SealedDerive2();

            Console.WriteLine(nb.NormalMethod());                   // 输出 NormalBase Method
            Console.WriteLine(sd.NormalMethod());                   // 输出 SealedDerive Method
            Console.WriteLine(sd1.NormalMethod());                  // 输出 SealedDerive Method
            Console.WriteLine(sd2.NormalMethod());                  // 输出 SealedDerive2 Method
        }
コード例 #2
0
        public static void Sealed_Classes_and_Methods()
        {
            NormalBase nb = new NormalBase();
            SealedDerive sd = new SealedDerive();
            SealedDerive1 sd1 = new SealedDerive1();
            SealedDerive2 sd2 = new SealedDerive2();

            Console.WriteLine(nb.NormalMethod());                   // 输出 NormalBase Method
            Console.WriteLine(sd.NormalMethod());                   // 输出 SealedDerive Method
            Console.WriteLine(sd1.NormalMethod());                  // 输出 SealedDerive Method
            Console.WriteLine(sd2.NormalMethod());                  // 输出 SealedDerive2 Method
        }