Skip to content

Latest commit

 

History

History
19 lines (16 loc) · 480 Bytes

MA0017.md

File metadata and controls

19 lines (16 loc) · 480 Bytes

MA0017 - Abstract types should not have public or internal constructors

Constructors on abstract types can be called only by derived types. Because public constructors create instances of a type, and you cannot create instances of an abstract type, an abstract type that has a public constructor is incorrectly designed.

abstract class Sample
{
    public Sample() // non-compliant
    {
    }
}

abstract class Sample
{
    protected Sample() // ok
    {
    }
}