1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5
6 /*------------------------------------------------------------------------------------------------------------
7 * 密封类:
8 * 1. 使用关键字 : sealed 修饰类名
9 * 2. 不能被继承
10 ------------------------------------------------------------------------------------------------------------*/
11 namespace 密封类
12 {
13 // 密封类: 基类
14 public sealed class SealedClass
15 {
16 //
17 }
18
19 // 派生类 : 派生自密封类SealedClass
20 public class TestSealedClass : SealedClass
21 {
22 // 会出现编译错误,因为密封类不可以被继承
23 }
24
25 class Program
26 {
27 static void Main(string[] args)
28 {
29 }
30 }
31 }