I know the rule of using inheritance when there is an is-a relationship, and composition when there’s a has-a relationship, but are the two mutually exclusive/replacements for one another or would there be a case where you should use both in the same class?
I’ve Googled a lot but only found articles explaining when you use each, rather than both.
Thanks
They are not mutually exclusive. Example:
BoatandSailboat.Sailboatis-aBoat, but it has-aSail, which otherBoats may or may not have.