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

Code inspection: Make constructor in abstract class protected

Last modified: 11 February 2024

It makes little sense to have the public modifier on an abstract class constructor. After all, an abstract class cannot be created directly – only via a derived instance. Consequently, it is only the derived classes for whom it makes sense to access the constructor in the first place. Hence, JetBrains Rider recommends that you make the constructor protected.