3 ms·
The example is just that, an example. There's no logical reason to not have contravariant parameter types - they follow directly from the Liskov substitution pr
by int_19h 8y ago
The example is just that, an example. There's no logical reason to not have contravariant parameter types - they follow directly from the Liskov substitution principle.
The reason why C++ doesn't have them is because they are relatively harder and more costly to implement than return types (consider that multiple inheritance means that pointer-to-derived often needs to be offset to be used as pointer-to-base).