Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mistake about final and override not affecting final classes; reword enforcement to be clearer #2235

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

leekillough
Copy link

Fix mistake about final and override not affecting final classes; reword enforcement to be clearer.

override and final on final classes

  • Note: On a class defined as final, it doesn't matter whether you put override or final on an individual virtual function.

That is incorrect. The semantics change if override or final is used on an individual virtual function. Correction:

  • Note: On a class defined as final, individual virtual functions cannot be overridden whether or not you put final on them. However, using override, or final without virtual, on a member function of a class marked final ensures that it overrides a base class virtual function.

Better Wording

  • Compare virtual function names in base and derived classes and flag uses of the same name that does not override.
  • Flag overrides with neither override nor final.

Better wording:

  • Compare virtual function names in base and derived classes and flag uses of the same name that do not have the same signatures and thus do not override.
  • Flag function overrides in derived classes containing neither override nor final.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant