抽象类,密封类 [英] Abstract Sealed Classes

查看:160
本文介绍了抽象类,密封类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关C ++ / CLI只是一个小问题。 抽象类有抽象方法由派生类来实现, 密封类不允许继承。

Just a small question about c++/cli. Abstract classes have abstract methods to be implemented by derived classes, sealed classes dont allow inheritance.

那么,为什么我们有一些类定义为抽象的.NET基础类库密封的,你可以找到很多..?!

So why we have some classes in .NET base class library defined as abstract sealed, and you can find plenty .. ??!

推荐答案

这相当于在C#语言的静态类。曾用于几乎所有的BCL类写的语言。所有这些方法必须是静态的。从类派生和创建它的实例声明它抽象和密封prevents任何人。

It is equivalent to "static class" in the C# language. The language that was used to write almost all of the BCL classes. All the methods must be static. Declaring it abstract and sealed prevents anybody from deriving from the class and creating an instance of it.

类的方法是在C和C ++语言的免费功能完全等效。事情的CLR不支持。

The class methods are the exact equivalent of free functions in the C and C++ language. Something the CLR does not support.

这篇关于抽象类,密封类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆