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

Moreland, Kenneth kmorel at sandia.gov
Wed May 18 13:24:09 EDT 2016


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? If the method is not final, wouldn't you want to declare the method virtual to ensure any subclass's override is called?

-Ken







On 5/18/16, 9:43 AM, "vtk-developers on behalf of Sean McBride" <vtk-developers-bounces at vtk.org on behalf of sean at rogue-research.com> wrote:

>On Fri, 6 May 2016 11:42:29 -0400, Marcus D. Hanwell said:
>
>>> The proposal is:
>>>
>>> * Use "virtual" on the original base class declaration of the method.
>>>
>>> * Do not use "virtual" in any derived class declaration of the method.
>>>
>>> * Use "override" on all derived classes.  Leave this off in C++03
>>>   by doing it through a macro.
>>>
>>> This will work in C++03, C++11, etc.
>>>
>>That is exactly what I was proposing - thanks Brad.
>
>Well, after a week I haven't heard any disagreements, so I updated my patch to remove the virtual keyword when adding override:
>
><https://gitlab.kitware.com/vtk/vtk/merge_requests/1458>
>
>If there is consensus, I'd appreciate a few +2's, then I'll merge and watch the dashboards.
>
>Cheers,
>
>-- 
>____________________________________________________________
>Sean McBride, B. Eng                 sean at rogue-research.com
>Rogue Research                        www.rogue-research.com 
>Mac Software Developer              Montréal, Québec, Canada
>
>
>_______________________________________________
>Powered by www.kitware.com
>
>Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
>Search the list archives at: http://markmail.org/search/?q=vtk-developers
>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtk-developers
>


More information about the vtk-developers mailing list