On 2018-02-16 12:54 PM, Ben Kelly wrote:
Are we supposed to just use override or final on methods that are overriden
when the class itself is marked final?

Personally writing final again seems redundant with the class level final
and the override keyword seems more informative.

You could use either final or override. My lint just checks syntax (using a regular expression). It doesn't know whether the class is final or whether a function declaration without any virtual/final/override specifier is overriding a base class's virtual function. (A clang plugin could.)

Specifying final might be safer than override. Someone might later make the class not final and then the `override` functions in the class can now be overridden. "final" is also shorter than "override". :)

final implies override *if* the function declaration does not also specify virtual. You can't tell whether `virtual void Huh() final` is overriding a base class function Huh() or actually declaring a new "virtual" function that can never be overridden. I found a few instances of these virtual/final declarations in mozilla-central. That's why the style guide recommends never using more than one of virtual, final, or override.

_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to