C# 10: Confusion with Sealed Classes and Inheritance in ASP.NET Core
I've been banging my head against this for hours. I've searched everywhere and can't find a clear answer. I'm working with an scenario with sealed classes in C# 10 while building my ASP.NET Core application. I have a base class that is marked as sealed, and I'm trying to create a derived class that inherits from it. However, I'm seeing a compiler behavior that states, "'MySealedClass' want to be inherited; it is sealed." I thought that sealed classes could only prevent inheritance from further derived classes, not from direct subclasses. Here is the code I'm working with: ```csharp public sealed class MySealedClass { public virtual string GetInfo() => "Sealed Class Info"; } public class DerivedClass : MySealedClass { public override string GetInfo() => "Derived Class Info"; } ``` I expected `DerivedClass` to be able to override `GetInfo()`, but instead, I'm getting the behavior mentioned above. I've also tried removing the `sealed` modifier and implementing an interface for testing, but that didn't yield the behavior I wanted either. My current setup is ASP.NET Core 6.0 with the latest C# 10 features enabled. Is there a design pattern or best practice I might be overlooking that would allow me to use similar functionality without working with this scenario? Any insights would be greatly appreciated! This is part of a larger service I'm building. I'm working with C# in a Docker container on Linux. Thanks, I really appreciate it!