A method with two parameters that both must be sent twice

says that I have a method that has two parameters. I execute them as:

if(aObj instance of Marble)   {
   if(bObj instance of Bomb)   {
      this.resolve((Marble)aObj,(Bomb)bObj);
   }
}

since you can see it is not a very beautiful solution. I plan to implement using dual dispatch, but with two parameters that both require dual dispatch, I'm afraid I'm a bit of a dead end. any ideas please.

im implementing in java btw.

+3
source share
1 answer

If possible, I would go with a visitor template .

, (, , ), , . , , object.accept(). "" - .

+1

Source: https://habr.com/ru/post/1746151/


All Articles