Composition and inheritance are conceptually different concepts. Composition is the “has a” relationship, while inheritance is the “is a” relationship. In real life, there are many clear examples that illustrate the conceptual differences between “has a” versus “is a”.
For example, a car has four wheels. This is clearly a “has a” relationship. In object oriented terms, we can say that the “Car” class has four (more or less) data members of the “Wheel” class. However, a race car “is a” car. In object oriented terms, the “RaceCar” class inherits from the “Car” class.