JiiPee <
n...@notvalid.com> wrote in news:hVxzw.540753$6k.7...@fx09.am4:
> On 01/02/2015 22:19, Chris Vine wrote:
>> The word "overrides" is in italics as a defined expression in
>> A§10.3/2 of C++11 (as also is "final overrider"), if that is what is
>> bothering you, and is applied exclusively to virtual functions.
>> A§10.3 contains a lengthy exposition of overriding. In C++11,
>> "override" (no 's') is a keyword applicable only to virtual
>> functions.
>>
>> Words are just labels. In C++ usage, "overriding" is applied to
>> virtual functions where polymorphic behaviour is expected, and
>> "hiding" is applied to non-virtual functions where you have static
>> dispatch.
>>
>> In discussing your code you can give the names any meaning you want,
>> provided YOU make it clear what you mean. But why not stick to common
>> usage? And what has pushed your button so hard on this?
>>
>> Chris
>
> ok, so overriding has a different meaning in C++ than in other
> languages. I am not english, but as far as i understand the word
> "override" really means that instead of using something you are using
> another thing. And thats what is happening here: when I write that foo
> in B then instead of using A's foo we are using B's foo, so it kind of
> "overrides" A's foo, isnt it? am just talking about english language
> grammar here, not really C++ language. So it would be natural for me
> to say that even non-virtual function overrides.
In order to see the "override" effect with the non-virtual functions you
need also to use an object of another type (or a pointer or reference to
another type). It is natural that an object of another type can have
different member functions than the first type, even if they happen to
share the same name and parameter list. In this sense, you are not
overriding anything, you are just using another type.
With virtual functions, the aim is to use pointers or references to the
base type and get the functionality of the actual (most derived) type.
This is quote another thing (and what OOP is mostly about).
That said, I believe most C++ folks will understand what you mean when
you are talking about overriding of non-virtual functions, just keep in
mind this is not quite correct technically.
Cheers
Paavo