From: Edward Diener on
Marco Nef wrote:
>>> Or is the virtuality inherited implicitly from the root of the
>>> inheritance tree even if it is omitted in intermediate classes?
>>
>> Yes. C++ does not require the programmer to repeat the 'virtual' keyword
>> for a virtual method in a derived class.
>
> Which is one of the worst "features" of C++ in large projects, as it causes
> lots of errors (how do you know that a method is virtual if it is not
> written in the declaration of the class you are working with?).

It is called documentation. That's how you know.

> It should
> also be that base methods can only be called in the direct base class, or
> the programmer has to explicitly write a cast to skip a hierachy level.

So if an inherited method is not in the immediate base class, you do not
think that a C++ derived class should be allowed to call it ?

>
> Some time ago I asked to change this in the new standard, so that virtual
> must be repeated in derived classes. But the reply in this group was that
> lots of old code would not compile anymore. That was a bad answer, as
> compilers could have a flag to ignore such an additional security
> feature in
> old code...

A better answer is simply that C++ programmers neither need or want this
feature which you consider so important.

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]