Inheritance design using Interface + abstract class. Good practice?

后端 未结 5 1663
时光说笑
时光说笑 2021-02-05 18:06

I\'m not really sure how to title this question but basically I have an interface like this:

public interface IFoo
{
    string ToCMD();
}

a co

5条回答
  •  故里飘歌
    2021-02-05 18:28

    you need the interface; you may or may not need the abstract class.

    in general, if you can provide some useful behavior in a base class, then provide a base class; if the base class is not complete by itself then make it abstract (MustInherit in VB parlance)

    otherwise, the interface is sufficient

提交回复
热议问题