3 ms·
But then I lose polymorphic dispatch, which is where this thread started.
by mrkeen 3y ago
But then I lose polymorphic dispatch, which is where this thread started.
- kaba0 3y agoIf you pass your object to another function, you only get static dispatch. What you want instead in this case, is a simple instance method. Then yourApple.rotateFruit() would do what you want, and rutateFruit could be an interface method declared in Apple, the superclass/interface.