Re:If Inheritance is so bad, why does everyone use it?
by kaba0 on Saturday April 13, 2024 @05:33AM
(#40021765)
If 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.
[ Parent
| on HN ]
There are no comments on this comment yet.