Abstract / Sealed classes

Mark R

Diamond Member
Oct 9, 1999
8,513
16
81
Why is it an error to define a class a abstract and sealed? (.NET v1.1)

I've got a couple of classes that could reasonably be defined as such. Am I missing something?

Not really looking for a solution, just musing.
 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
Abstract classes cannot be instantiated and must be used as base classes.

Sealed classes cannot be used as base classes.

The two are mutually exclusive.

Text
 

Mark R

Diamond Member
Oct 9, 1999
8,513
16
81
I appreciate that you wouldn't normally want to do this.

However, I have a couple of classes that define only static methods. As instantiating such a class would be meaningless, I define them abstract.

However, as there are no instance methods, a derived class would be meaningless. So they could, for what it's worth, be defined sealed.