[webkit-dev] 'final' class specifier and 'final' method specifier

Konstantin Tokarev annulen at yandex.ru
Wed Dec 19 11:52:36 PST 2018



19.12.2018, 12:53, "Fujii Hironori" <fujii.hironori at gmail.com>:
> I'd like to change this because 'final' doesn't necessarily imply
> 'override'. See the following stackoverflow:
> https://stackoverflow.com/questions/29412412/does-final-imply-override

It does imply override, unless it is used in a declaration of new virtual method
(which has no practical meaning fwiw)

>
> IIUC, 'final' method specifier can be useful for such like the following case:
>
>> class B {
>> public:
>>   virtual foo();
>>   virtual bar();
>> };
>> class B1 : public B {
>>   foo() final;
>> };
>> class D final : B1 {
>>   bar() override;
>> };
>
> The 'final' method specifier indicates D can't override the method foo.
> Thus, using 'final' method specifier implies other virtual functions
> can be overridden. I'm not sure my understanding right. Please correct me.

final method specifier on foo doesn't affect other methods anyhow, it just forbids
overriding of foo

>
> ,
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev


-- 
Regards,
Konstantin


More information about the webkit-dev mailing list