On 2 June 2013 19:06, Gerald Pfeifer wrote:
> On Fri, 26 Apr 2013, Jonathan Wakely wrote:
>> On 26 April 2013 13:09, Jurgis Upenieks wrote:
>>> I think that I have found a bug in gcc home page gcc-4.7 changes.
>>> In C++ paragraph about explicit override control.
>>> In example code, is it really struct, not class?
>> Yes, that's valid C++, the example is fine.
>
> I guess the alternative way to write this, using class instead of
> struct, is the following (which needs an extra protected).

Generally in that context protected access would be wrong, it would
mean you can't call the virtual functions on the base class, which
usually defeats the purpose of having virtual functions.

To be equivalent to the original code you'd want 'public', but you'd
also want to add it to the base classes, so that they are
publicly-derived, but doing so adds additional keywords to the example
that contribute nothing.

> Should we go with this, Jonathan?  What do you think?

I think the example is fine as is and doesn't need to change.

Reply via email to