abstract
classes with only abstract
methods should be declared as interface
s CS-R1078The abstract
keyword in C# indicates that an entity is missing its full implementation and that is responsbility of the inheritor to complete or fulfil it. The said keyword applies to both class
es and methods. If a class is declared as an abstract
class and only has abstract
methods, it is more suitable to convert it to an interface
as interface
s are designed for the exact same purpose. Meaning, an abstract
class should have at least some minimal implementation. If a class was declared abstract
to prevent users from instantiating it, consider changing the constructor's visibility.
abstract class Foo
{
public abstract void Bar();
public abstract void Baz();
}
interface IFoo
{
public abstract void Bar();
public abstract void Baz();
}