C#

C#

By DeepSource

abstract classes cannot contain public constructors CS-R1096

Anti-pattern
Autofix

Since an abstract class cannot be instantiated, it is pointless to have a public constructor. Consider narrowing down the access modifier to either protected or private.

Examples

Bad Practice

abstract class C
{
    public C()
    {
    }
}

Recommended

abstract class C
{
    protected C()
    {
    }
}