ReSharper
 
Get ReSharper
Get your hands on the new features ahead of the release by joining the Early Access Program for ReSharper 2025.1! Learn more

Code inspection: Class with virtual (overridable) members never inherited (private accessibility)

Last modified: 27 May 2024

This inspection reports private classes that have one or more overridable members (virtual in C# or Overridable in Visual Basic), but have no inheritors in the current local scope.

On the one hand, making a member overridable indicates an intention to override it in a subclass, but on the other hand, there are no subclasses.

To resolve this contradiction, consider removing the virtual or Overridable modifiers. If the class is intentionally designed not to have any inheritors, you could add the sealed (NotInheritable in Visual Basic) modifier to the class.