Once in a while I have the problem that I need (to prevent me from writing an absurd amount of code) to inherit a sealed class.
What it does:
Create a new class that implements all interfaces and public methods of the original sealed class and embeds a private field with an instance of this sealed class. All the methods and operators are rerouted to the original class /instance in the private field. Further, narrowing and widening operators are available to convert this class to it’s ancestor.
An example:
Public NotInheritable Class SealedClass
Public Sub SomeMethod
'dosomething
End Sub
End Class
To Shadow this class (so inherit a sealed class):
Public Class InheritedClass Shadows SealedClass
End Class
This translates to the code:
Public Class InheritedClass
Private Ancestor as SealedClass
Private Sub New(ancestor as SealedClass)
Me.Ancestor = ancestor
End Sub
Public Sub SomeMethod
Ancestor.DoSomething
End Sub
Public Shared Narrowing Operator CType(bs As InheritedClass) As SealedClass
Return bs.Ancestor
End Operator
Public Shared Narrowing Operator CType(bs As SealedClass) As InheritedClass
Return New InheritedClass(bs)
End Operator
End Class
So, just a way to make some kind of inheritance from sealed classes, where all virtual methods and properties become non-virtual. Never optimal, but in some cases it make things possible that are otherwise almost impossible, just because the ancestor is sealed.
In your ecosystem, it could be done even more easily; implement it as a mapped class where all public methods and operators are mapped to the original class unless implemented in the shadow class.