# on a way of supporting multiple inheritance in Solidity

Question in one sentence:

Regarding function calls, to infer the what the most derived function is, is it enough to track functions in base contracts for each contract, or do we also have to consider the final inheritance graph?

An example below clarifies my question:

``````contract B {
function testb() public{ }
}
contract C{
function testc() public{ }
}

contract D is B,C {
function testd() public{ }
}
``````

In the above code, are no functions copied into the contract C? Or, should the function testb in contract B be copied into the contract C as the final inheritance graph is D->C->B?

Solidity docs says that:

the code from all the base contracts is copied into the created contract.

Based on the description above, it seems that no functions may be copied into the contract C, as the C has no base contracts.

However, I am still confused because I do not know when we have to consider final inheritance graph. Solidity docs explains only one such case (super call).

• Solidity uses C3 linearization: solidity.readthedocs.io/en/v0.4.25/…. Commented Nov 4, 2018 at 11:09
• `as the final inheritance graph is D->C->B` - this is not the final inheritance graph in your coding example (contract `C` does not inherit from contract `B`). Commented Nov 4, 2018 at 14:08
• @RobHitchensB9lab I did not understand your intention. `D` can be deployed and I again confirmed it by testing the code in Remix. Commented Nov 4, 2018 at 14:22
• @goodvibration Supposing the contract `D` is deployed, the final inheritance graph is D->C->B. Commented Nov 4, 2018 at 14:24
• @goodvibration. You're right. My mistake eyeballing it. Commented Nov 4, 2018 at 14:30