[rtual]
Maybe your like
11 Classes [class]
11.7 Derived classes [class.derived]
11.7.3 Virtual functions [class.virtual]
1#A non-static member function is a virtual function if it is first declared with the keyword virtual or if it overrides a virtual member function declared in a base class (see below).87 [Note 1: Virtual functions support dynamic binding and object-oriented programming. — end note] A class with a virtual member function is called a polymorphic class.882#If a virtual member function F is declared in a class B, and, in a class D derived (directly or indirectly) from B, a declaration of a member function G corresponds ([basic.scope.scope]) to a declaration of F, ignoring trailing requires-clauses, then G overrides89 F. For convenience, we say that any virtual function overrides itself. A virtual member function V of a class object S is a final overrider unless the most derived class ([intro.object]) of which S is a base class subobject (if any) has another member function that overrides V. 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. [Example 1: struct A { virtual void f(); }; struct B : virtual A { virtual void f(); }; struct C : B , virtual A { using A::f; }; void foo() { C c; c.f(); // calls B::f, the final overrider c.C::f(); // calls A::f because of the using-declaration } — end example][Example 2: 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 — end example]3#[Note 2: A virtual member function does not have to be visible to be overridden, for example, struct B { virtual void f(); }; struct D : B { void f(int); }; struct D2 : D { void f(); }; the function f(int) in class D hides the virtual function f() in its base class B; D::f(int) is not a virtual function. However, f() declared in class D2 has the same name and the same parameter list as B::f(), and therefore is a virtual function that overrides the function B::f() even though B::f() is not visible in class D2. — end note]4#If a virtual function f in some class B is marked with the virt-specifier final and in a class D derived from B a function D::f overrides B::f, the program is ill-formed. [Example 3: struct B { virtual void f() const final; }; struct D : B { void f() const; // error: D::f attempts to override final B::f }; — end example]5#If a virtual function is marked with the virt-specifier override and does not override a member function of a base class, the program is ill-formed. [Example 4: struct B { virtual void f(int); }; struct D : B { virtual void f(long) override; // error: wrong signature overriding B::f virtual void f(int) override; // OK }; — end example]6#A virtual function shall not have a trailing requires-clause ([dcl.decl]). [Example 5: template<typename T> struct A { virtual void f() requires true; // error: virtual function cannot be constrained ([temp.constr.decl]) }; — end example]7#The ref-qualifier, or lack thereof, of an overriding function shall be the same as that of the overridden function.8#The return type of an overriding function shall be either identical to the return type of the overridden function or covariant with the classes of the functions. If a function D::f overrides a function B::f, the return types of the functions are covariant if they satisfy the following criteria:- (8.1)both are pointers to classes, both are lvalue references to classes, or both are rvalue references to classes90
- (8.2)the class in the return type of B::f is the same class as the class in the return type of D::f, or is an unambiguous and accessible direct or indirect base class of the class in the return type of D::f
- (8.3)both pointers or references have the same cv-qualification and the class type in the return type of D::f has the same cv-qualification as or less cv-qualification than the class type in the return type of B::f.
Tag » C++ No Unique Final Overrider For
-
Virtual Inheritance: Error: No Unique Final Overrider - Stack Overflow
-
No Unique Final Overrider With Virtual B - C++ Forum
-
Virtual Inheritance Error No Unique Final Overrider - C++ - YouTube
-
Virtual Function Specifier
-
Virtual, Final And Override In C++
-
Dreaded Diamond - C++ - DaniWeb
-
Use C++11 Inheritance Control Keywords To Prevent Inconsistencies ...
-
CXXFinalOverriderMap Class Reference - Clang
-
Programmation Orientée Objet (C++) : [5pt] Héritage Multiple - EPFL
-
Std-discussion: Re: More Than One Final Overrider Of A Virtual Functions.
-
Final Specifier (since C++11)
-
"override" Or "final" Should Be Used Instead Of "virtual"
-
Inheritance — What Your Mother Never Told You, C++ FAQ
-
1782 – C++ Erroneous Requirement For Final Overrider