Is there any reason for an empty concrete method in an abstract class?

后端 未结 3 948
情深已故
情深已故 2021-01-05 18:34

I was recently looking through some open source code PicketLink code. If you take a look at this class, you\'ll see a number of concrete methods in an abstract class that d

3条回答
  •  迷失自我
    2021-01-05 18:48

    While not the most common case, sometimes it is handy in the context of a template method. In this case there is a method that defines the flow, leaving the concrete implementation of some parts to its subclasses. In some cases a default concrete behavior is to do nothing, leaving the concrete method in the base class empty, but allowing customization in the subclass by overriding it.

    HTH

提交回复
热议问题