3 ms·
Am I missing something or can most of the examples just be achieved with method overloading?
by leifg 9y ago
Am I missing something or can most of the examples just be achieved with method overloading?
- ysleepy 9y agoJava only has single dynamic dispatch. That means it will use the method of the most specific sub-class, but will not dispatch on the runtime type of the argument, only its compile time type. So something like: for(None n: expreTree.children()) { intMath.eval(n); } will not work as expected if eval is overloaded.