Rule A10-1-1 (required, implementation, automated)

Class shall not be derived from more than one base class which is not an interface class.

Rationale

Multiple inheritance exposes derived class to multiple implementations. This makes the code more difficult to maintain. See: Diamond-Problem, Interface-Class

Example

// $Id: A10-1-1.cpp 289436 2017-10-04 10:45:23Z michal.szczepankiewicz $
#include <cstdint>
class A
{
public:
void F1() noexcept(false) {}

private:
std::int32_t x{0};
std::int32_t y{0};
};
class B
{
public:
void F2() noexcept(false) {}

private:

std::int32_t x{0};
};
class C : public A,
public B // Non-compliant - A and B are both not interface classes
{
};
class D
{
public:
virtual ~D() = 0;
virtual void F3() noexcept = 0;
virtual void F4() noexcept = 0;
};
class E
{
public:
static constexpr std::int32_t value{10};

virtual ~E() = 0;
virtual void F5() noexcept = 0;
};
class F : public A,
public B,
public D,
public E // Non-compliant - A and B are both not interface classes
{
};
class G : public A,
public D,
public E // Compliant - D and E are interface classes
{
};

See also

JSF December 2005 [8]: AV Rule 88 Multiple inheritance shall only be allowed in the following restricted form: n interfaces plus m private implementations, plus at most one protected implementation. HIC++ v4.0 [9]: 10.3.1 Ensure that a derived class has at most one base class which is not an interface class. C++ Core Guidelines [11]: C.135: Use multiple inheritance to represent multiple distinct interfaces.