开发者

Abstract Sealed Classes

开发者 https://www.devze.com 2023-01-14 16:50 出处:网络
Just a small question about c++/cli. Abstract classes have abstract methods to be implemented by derived classes,

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

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


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.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消