== Why is this an issue?

The use of ``++virtual++`` base classes can introduce a number of undefined and potentially confusing behaviours. Therefore, a base class shall only be declared ``++virtual++`` if that base class is to be used as a common base class in a diamond hierarchy.


=== Noncompliant code example

[source,cpp]
----
class A {};
class B1: public virtual A {}; // Compliant, A is a common base for C
class B2: public virtual A {}; // Compliant, A is a common base for C
class C: public B1, B2 {};
class D: public virtual A {}; // Noncompliant, D is not part of a diamond-shaped hierarchy.
----


== Resources

* MISRA {cpp}:2008, 10-1-2 - A base class shall only be declared virtual if it is used in a diamond hierarchy.


ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Remove the "virtual" specifier on class "xxx".


'''
== Comments And Links
(visible only on this page)

=== on 16 Oct 2014, 13:21:54 Ann Campbell wrote:
\[~samuel.mercier] please:

* fill in the appropriate reference field(s).
* provide a See section.
* use double curly braces around code in the description
* use the standard section titles

Also, since the description references undefined behavior, I wouldn't tie this to Maintainability, but Reliability instead.

endif::env-github,rspecator-view[]
