V
Victor Bazarov
Since this thread has already mentioned Ada as an example of a language
where this kind of non-hiding can happen, perhaps it is apropos to
explain what would happen in Ada for this example:
Adding the function Base::f would make the call d.f(3) ambiguous, since
the compiler could not decide if the literal "3" should be taken as
integer or long-integer. Thus the compilation would fail, and the
programmer would have to say explicitly which type should be used for
"3", and this would determine if the call is to Base::f or to Derived::f.
So this example would "work" (be safe) in Ada because Ada does not have
the wide range of automatic type conversions and the "best match"
ambiguity resolver that C++ uses.
(I'm a habitual Ada programmer who is now trying to learn more about
C++. From my perspective, the automatic type conversions in C++ are
rather hair-raising
This is all a matter of personal preference, I would guess. Thirty
percent of countries in the world have cars normally moving on the left
side of the road. I find that rather hair-raising, and they do it every
day without even blinking.
Let's not submerge ourselves in feature bashing or language comparison,
shall we? Never does anything good come out of any of those
"discussions" here or in any other place.
V