The next code:

struct interface_base
{
    virtual void foo() = 0;
};

struct interface : public interface_base
{
    virtual void bar() = 0;
};

struct implementation_base : public interface_base
{
    void foo();
};

struct implementation : public implementation_base, public interface
{   
    void bar();
};

int main()
{
    implementation x;
}

does not compile using the following errors:

test.cpp: In function 'int main()':
test.cpp:23:20: error: cannot declare variable 'x' to be of abstract type 'implementation'
test.cpp:16:8: note:   because the following virtual functions are pure within 'implementation':
test.cpp:3:18: note:    virtual void interface_base::foo()

I've performed around by using it and determined that creating the 'interface -> interface_base' and 'implementation_base -> implementation' inheritances virtual, fixes the issue, however i do not understand why. Can someone please explain what's going on?

p.s. I overlooked the virtual destructors purposely to create the code shorter. Do not let me know to insert them in, I know :)

You've two interface_base base classes inside your inheritance tree. Which means you must provide two implementations of foo(). And calling either of these is going to be really awkward, needing multiple casts to disambiguate. This usually isn't what you would like.

To solve this, use virtual inheritance:

struct interface_base
{
    virtual void foo() = 0;
};

struct interface : virtual public interface_base
{
    virtual void bar() = 0;
};

struct implementation_base : virtual public interface_base
{
    void foo();
};

struct implementation : public implementation_base, virtual public interface
{   
    void bar();
};

int main()
{
    implementation x;
}

With virtual inheritance, just one demonstration of the bottom class under consideration is produced within the inheritance heirarchy for those virtual mentions. Thus, there's just one foo(), which may be satisfied by implementation_base::foo().

To learn more, see this prior question - the solutions provide some nice diagrams to create all of this more obvious.

For that situation of 'solving' the gemstone inheritance problem, the solutions provided by bdonlan are valid. With that said, you are able to steer clear of the gemstone-trouble with design. How come every demonstration of confirmed class be viewed as both classes? Are you currently ever likely to pass this same resist a category that states something similar to:

void ConsumeFood(Food *food);
void ConsumeDrink(Drink *drink);

class NutritionalConsumable {
  float calories() = 0;
  float GetNutritionalValue(NUTRITION_ID nutrition) = 0;
};
class Drink : public NutritionalConsumable {
  void Sip() = 0;
};
class Food : public NutritionalConsumable {
  void Chew() = 0;
};
class Icecream : public Drink, virtual public Food {};

void ConsumeNutrition(NutritionalConsumable *consumable) {
  ConsumeFood(dynamic_cast<Food*>(food));
  ConsumeDrink(dynamic_cast<Drink*>(drink));
}

// Or moreso
void ConsumeIcecream(Icecream *icecream) {
  ConsumeDrink(icecream);
  ConsumeFood(icecream);
}

Surely it might be better within this situation for Icecream to simply implement NutritionalConsumable and supply a GetAsDrink() and GetAsFood() method which will return a proxy, purely with regard to showing up as either food or drink. Otherwise that indicates that there's a technique or object that accepts a Food but in some way really wants to later view it like a Drink, which could simply be accomplished having a dynamic_cast, and need not be having a appropriate design.