• Hans Johnson's avatar
    COMP: Add more C++11 override instrumentation · bcf798e7
    Hans Johnson authored
    Providing override key work allows for extra checking
    that the function signatures are correct.
    
    https://stackoverflow.com/questions/39932391/virtual-override-or-both-c?answertab=active#tab-top
    
    In the derived class the function is virtual by way of having the ¹same
    type as the base class function.
    
    However, an override can help avoid bugs by producing a compilation
    error when the intended override isn't technically an override. E.g.
    that the function type isn't exactly like the base class function. Or
    that a maintenance of the base class changes that function's type, e.g.
    adding a defaulted argument.
    
    In the same way, a virtual keyword in the derived class can make such a
    bug more subtle, by ensuring that the function is still virtual in
    further derived classes.
    
    The general advice is,
         -Use virtual for the base class function declaration.
          This is technically necessary.
    
         -Use override (only) for a derived class' override.
          This helps maintenance.
    bcf798e7
GraphItem.cxx 2.58 KB