1、文件--》新建--》项目。
2、选择为:控制台应用程序--》命名:使用sealed密封关键字后string类型不能被继承--》确定。
3、确定后系统会自动生成代码。
4、先写个测试父类Person,父类中使用sealed密封关键字。
5、写一个子类继承父类。
6、测试程序,程序会报错并提示sealed密封类不能被派生继承。
1、文件--》新建--》项目。
2、选择为:控制台应用程序--》命名:使用sealed密封关键字后string类型不能被继承--》确定。
3、确定后系统会自动生成代码。
4、先写个测试父类Person,父类中使用sealed密封关键字。
5、写一个子类继承父类。
6、测试程序,程序会报错并提示sealed密封类不能被派生继承。