Then what does it mean if "composition over inheritance" is also taught as a good practice in OO?
That's a rule-of-thumb to help beginners in making judgement calls. It doesn't mean inheritance should never be used.
That's a rule-of-thumb to help beginners in making judgement calls. It doesn't mean inheritance should never be used.