steenooo
03/07/2020, 1:45 PMe.entity
is "Entity". Many classes derive of this interface. But, I only want to do something with them if they're either Horse or Panda. And if they are, I want to do something general, for both panda and horse. And I want to also do something specific for them pandas and for horses
I know It is possible to do the current construction, or copy the code which should be executed for both. But I was wondering if there was a more concise way to do this.Fleshgrinder
03/07/2020, 2:42 PMwhen
since you only have 2 possibilities and already checked that either is true. Hence, a if (target is Panda) { /*panda specific*/ } else { /*horse specific */ }
will do.Jakub Pi
03/07/2020, 2:45 PMFleshgrinder
03/07/2020, 2:49 PMsultanofcardio
03/07/2020, 9:16 PMjimn
03/09/2020, 6:23 AMwhile