Alternative to instanceof?

后端 未结 4 673
清歌不尽
清歌不尽 2021-01-07 07:17

I\'ve heard that it is bad design to use instanceof or equivalent (http://www.javapractices.com/topic/TopicAction.do?Id=31, when should we use instanceof and when not) which

4条回答
  •  梦谈多话
    2021-01-07 07:56

    In general, polymorphism is the way to avoid unnecessary instanceof operator.

提交回复
热议问题