= Solution
Write each <Scala trait linearization> from most specific to least specific. Merge the parents' <Scala trait linearizations> right-to-left, removing a duplicate from the earlier portion when it also appears in the later portion. This retains every base once while respecting its required position after derived <traits>.<Scala 2.11 classes and objects specification>[Class Linearization]{ref}
``
CityMan, City, Earth, Man, Mammal, Animal, Describe
BirdMan, City, Earth, Man, Mammal, Bird, Animal, Describe
BatMan, Man, Gotham, City, US, Earth, Bat, Mammal, Bird, Animal, Describe
``
For example, combining the final `City` with `Gotham` does not put `City` before its derived <trait> `Gotham`; duplicate removal places it after `Gotham`. Similarly `Mammal` and `Bird` remain after `Bat`, despite their occurrence through other parents.
Each `describe` calls `super.describe` before appending its own label. Thus execution enters implementations along the displayed <Scala trait linearization>, and appends labels in reverse order when calls return. The three printed lines are
``
Describe, Animal, Mammal, Man, Earth, City,
Describe, Animal, Bird, Mammal, Man, Earth, City,
Describe, Animal, Bird, Mammal, Bat, Earth, US, City, Gotham, Man,
``
Each line has a final comma and space, because every printed <string> fragment includes them. The essential result is
$$
\boxed{\text{Output labels follow the reverse linearization, excluding the concrete class.}}
$$
Back to article page