Abstract class extends concrete class

前端 未结 5 1818
时光取名叫无心
时光取名叫无心 2020-12-14 15:44

I earlier learned that abstract class can extend concrete class. Though I don\'t see the reason for it from JAVA designers, but it is ok. I also learned that abstract class

5条回答
  •  太阳男子
    2020-12-14 16:13

    If you make the test method abstract it forces anyone deriving from the Bar class provide an implementation of the method.

    If you remove the abstract method from the Bar class then anyone deriving from Bar would not have to implement the test method as Foo already provides an (empty) implementation.

提交回复
热议问题