what is the advantage of interface over abstract classes?

前端 未结 9 1888
野的像风
野的像风 2021-02-01 05:48

In Java, abstract classes give the ability to define both concrete and abstract methods whereas interfaces only give the ability to implement abstract methods. I believe overrid

9条回答
  •  [愿得一人]
    2021-02-01 06:33

    You dont override an interface. You implement it.

    Writing an interface gives implementors the ability to implement your interface and also other interfaces in addition to inheriting from a base class.

    Abstract classes can be partially or fully implemented.Marking a class abstract just prevents you from instantiating an object of that type.

提交回复
热议问题