News for hackers. Stuff that matters.
Re:If Inheritance is so bad, why does everyone use it? by rtz121 on Thursday April 11, 2024 @12:43PM (#40004161)
> If I have a fruit which is an apple or a banana, I can't pass that to a method expecting an apple or banana. It can only be passed as a fruit.

You can by overriding the method on apple or banana. If your method is on some other object, then yes, you cannot do this unless your programming language supports multiple dispatch.

There are no comments on this comment yet.