Yes, but there are different kinds of composition.
With a class when you inherit from another class, it could be said you are "composing" the two classes together. In this type of composition (assuming everything is virtual methods), the subclass will "shadow" the superclass, but the superclass is still accessible to the subclass.
With roles/traits the composition does not shadow but (via a set of rules) combine the two sets of methods/attributes into a new composite role/trait. In fact, after composition, the original roles can be discarded as all the nessecary info is now contained in the composite role. Also, because of the rules of composition, roles/traits are unordered, meaning you can compose the same set of roles/traits in arbitrary ways and still get the same composite trait in the end.
| [reply] |
| [reply] |