Is there a good design pattern: common method has a superclass param but contains calls to methods available in child classes (thus requiring casting)

后端 未结 0 1193
失恋的感觉
失恋的感觉 2021-02-01 22:19

So if I wanted a method to be common for 3 child classes, like this:

public void commonForAllAnimals(Animal animal) {
  // this method exists in subclasses that I         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题