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

C.139 - remove note about capping virtual functions #2236

Open
WelliSolutions opened this issue Nov 19, 2024 · 0 comments
Open

C.139 - remove note about capping virtual functions #2236

WelliSolutions opened this issue Nov 19, 2024 · 0 comments

Comments

@WelliSolutions
Copy link

WelliSolutions commented Nov 19, 2024

C.139 says

Note: Capping an individual virtual function with final is error-prone as final can easily be overlooked when defining/overriding a set of functions. Fortunately, the compiler catches such mistakes: You cannot re-declare/re-open a final member in a derived class.

I don't consider this as error-prone. Sure, it generates a compiler error, but that's not the common sense of error-prone.

If you consider this error-prone, let me make this statement as a counter-argument:

The definition of an int is error-prone as quotation marks can easily be overlooked when defining an int. Fortunately, the compiler catches such mistakes: you can't assign a string to it.

Proposal: simply remove the note. Using final on virtual methods works as in Java or C#. It's just normal to get a compiler error.

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

No branches or pull requests

1 participant