Inherit from multiple base classes and understand the diamond problem.
Multiple inheritance allows a derived class to inherit members from more than one base class. The syntax is straightforward: `class Derived : public Base1, public Base2 { ... };`. The `Derived` class will now contain all the public and protected members from both `Base1` and `B`ase2. While this can be a powerful tool for combining functionalities, it can also lead to the 'diamond problem'. This occurs in the following inheritance structure: a class `D` inherits from two classes `B` and `C`, and both `B` and `C` inherit from a common base class `A`. This creates a diamond-shaped inheritance diagram. The problem is that class `D` will inherit two copies of the members of class `A` (one via `B` and one via `C`). If you try to access a member of `A` from an object of `D`, the compiler will issue an ambiguity error because it doesn't know which copy to use. This issue highlights the potential complexity of multiple inheritance and is a reason why some other object-oriented languages choose not to support it. C++, however, provides a solution to this problem through virtual inheritance.