Remix.run Logo
duped 6 hours ago

I have always heard "prefer composition to inheritance" also referred to as "has a" instead of "is a." Meaning:

    class Dog : Animal; // inheritance 
    class Car: 
        Wheels wheels; // composition
creata 5 hours ago | parent [-]

Yep. "Composition" has many meanings, but in the context of "inheritance vs. composition" it's just referring to "x has a y".