[vtk-developers] VTK Coding Standards, C++11 override and =delete

Brad King brad.king at kitware.com
Wed May 18 13:27:56 EDT 2016


On 05/18/2016 01:24 PM, Moreland, Kenneth wrote:
> Maybe I'm being stupid, but can someone explain why you would
> _not_ use the virtual keyword on any derived class declaration
> of the method?

It is redundant with both the `virtual` specifier on the signature
in the base class and with the `override` specifier now being added.

> If the method is not final, wouldn't you want to declare the
> method virtual to ensure any subclass's override is called?

Once a method is virtual the subclass implementations do not need
to be explicitly marked virtual to allow their subclasses to also
override it.  Once virtual always virtual.

-Brad



More information about the vtk-developers mailing list