C++ Logo


Advanced search

More than one final overrider of a virtual functions.

From: Vladimir Grigoriev <vlad.moscow_at_[hidden]>
Date: Tue, 17 Aug 2021 20:16:31 +0300
In the paragraph #2 of the section «11.7.2 Virtual functions» if the C++ 20 Standard there is written
«In a derived class, if a virtual member function of a base class subobject has more than one final overrider the program is ill-formed.»
And there is an example
struct A { virtual void f(); };
struct B : A { };
struct C : A { void f(); };
struct D : B, C { }; // OK: A::f and C::f are the final overriders
                            // for the B and C subobjects, respectively
If I understand correctly should there the comment be appended that the code snippet is ill-formed because the class D has two final overriders of the functions f?
With best regards
(Vlad from Moscow)
You can meet me at http://cpp.forum24.ru/ or www.stackoverflow.com or http://ru.stackoverflow.com

Received on 2021-08-17 12:16:41