Multiple inheritance name collisions

I am trying to understand how multiple inheritance in Solidity works with this snippet of code. where contract C inherits from A,B with each having function foo.

``````pragma solidity ^0.6.0;

contract A {
function foo() public pure returns (uint8){
return 1;
}
}

contract B {
function foo() public pure returns (uint8){
return 2;
}
}

contract C is A,B {

}
``````

I got the following error when I tried to compile

``````contract C is A,B {
^ (Relevant source part starts here and spans across multiple lines).
browser/multiple_inheritance.sol:4:5: Definition in "A":
function foo() public pure returns (uint8){
^ (Relevant source part starts here and spans across multiple lines).
browser/multiple_inheritance.sol:12:5: Definition in "B":
function foo() public pure returns (uint8){
^ (Relevant source part starts here and spans across multiple lines).
``````

Does it mean in Solidity 0.6 name collision for multiple inheritance is not resolvable.

This is also known as The Diamond Inheritance Problem.

In Java it is not permitted.

In C++ it can be resolved as follows:

``````class Base {...}

class A : public virtual Base {...}

class B : public virtual Base {...}

class C : public A, public B {...}
``````

In Solidity it is currently (0.6.x) not supported.

• I mean in Python if I write `class C(A,B)` then the function will be searched in the order C, A, B (i.e. left to right), so when the document says the order in Solidity is from right to left I would assume `contract C is A,B' means the order of searching for function would be C, B, A. Apr 28, 2020 at 9:59