https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78010

--- Comment #4 from ol.rakhimov at gmail dot com ---
(In reply to Arnaud Desitter from comment #3)
> Interesting reference. Note that "virtual + final" can be useful even if the
> core guidelines discourage its use.
> 
> struct A {
>   virtual void f() final;
> };
> struct B : A {
>    // "void f()" cannot be defined
> };

I've seen this in Bjarne's C++11 FAQ/INFO pages,
but why would you do that? It's weird and uncommon.
Virtual implies functionality to be overridden.
If no override is permitted,
just use good-old plain member function.

struct A {
  void f();
};

struct B : A {
  void f();  // Comiler may warn about the hiding of A::f
};

Reply via email to