Understanding the purpose of Abstract Classes in Java

前端 未结 8 1721
伪装坚强ぢ
伪装坚强ぢ 2020-12-01 06:15

Suppose I have two Classes, A and B. The A class is defined as abstract, while B extends this abstract class, and finally i test the result and both classes are part of same

8条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-01 06:23

    Abstract Classes allow you to store base level implementations (inheritance), while also producing a contract that guarantees inherited classes will implement specific functionality (interface) on their own...

    While there will never be a instance of an Abstract Class, you can store shared functionality between inheritors...

    I've always thought of them as Interfaces that allow base level implementations of certain methods...

提交回复
热议问题