Re: Does covariant return types hold for non-virtual?
On 17.05.2010 01:48, * Paul Bibbings:
Whatever `covariant' means "in general" is irrelevant [to using this term
in general] owing to the fact that the ISO defines the term specifically
according to what it requires for its purposes.
Of course the general meaning is not irrelevant.
You may consider that early C++ compilers generally didn't support covariant
reseult types, that one current compiler (MSVC) has trouble with them in
connection with virtual inheritance, and that C++ as a language doesn't support
covariant smart pointers as result type, and that for all three cases the
practical answer is to implement the covariance yourself.
Implementing the covariance (correctly) in such cases is based on covariant
result types of a non-virtual function; the external interface remains the same
as if the compiler and/or language had supported this.
But with your and Joshua's terminology you can't even talk about that.
Is that practical, do you think?
From my point of view it's like an adult maintaining that "gravity" is Earth's
attraction and that only, apparently because that's all the person is familiar
with, and dismissing the gravity of neutron stars since they're far out of
Earth's reach: "that's not gravity".
I do not assume that an adult taking such a view actually believes it himself or
herself.
Cheers,
- Alf
--
blog at <url: http://alfps.wordpress.com>
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]