Can you help me understand in a practical example the usage abstract classes vs interfaces?

前端 未结 9 650
孤城傲影
孤城傲影 2020-12-24 04:09

Can you give me an almost overly simplistic understanding of abstract class vs inheritance use and help me so I can truly understand the concept and how to implement? I have

9条回答
  •  离开以前
    2020-12-24 04:46

    Abstract Classes: Establish a base for derived classes they provide a contract for all derived classes. It enforces heirarchies

    Interfaces:

    An interface is not a class, its a definition of methods.

    A class can inheirt multiple interfaces but only one abstract class.

    I hope that helps

提交回复
热议问题