What is exact difference between Inheritance and Abstract class?

后端 未结 5 947
心在旅途
心在旅途 2021-02-06 00:46

I know the fundamentals of OOP concepts[Inheritance, Abstraction, Encapsulation, Polymorphism]

We use Inheritance in case of Parent-Child relationship[C

5条回答
  •  無奈伤痛
    2021-02-06 01:02

    With inheritance you don't need to override a method. Without overriding getROI in Child you could still call new Child().getROI() and get 0 as response.

    If on the other hand a method is abstract, it will need to be implemented by the child as there is no default implementation.

提交回复
热议问题