C#C
C#3y ago
Hugh

❔ ✅ Stopping any additional subclassing of a class

I've got the following code:

public abstract class MyBase {}

public class MyType1 : MyBase {}
public class MyType2 : MyBase {}


Is there a way of stopping any other classes subclassing MyBase other than the two here? I need to be able to do these subclasses, but don't want anyone to be able to do any more.
Was this page helpful?