
April 7, 2022
2:10 a.m.
Chris Angelico writes:
I'm curious when you would ever be subclassing something from another library without knowing its hierarchy.
When the class is a public API, no? I'm not sure why this isn't obvious, am I missing something? One really plausible example is given in Raymond's piece: a later version of the same library refactors a "monolithic" class as a child of one or more "private" classes that are not intended to be exposed in the public API, but your multiply-derived class *written before the refactoring* Just Works. As far as I can see, super(), and maybe even the deterministic MRO, is needed to make that work. Steve