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).
as the final inheritance graph is D->C->B
- this is not the final inheritance graph in your coding example (contractC
does not inherit from contractB
).D
can be deployed and I again confirmed it by testing the code in Remix.D
is deployed, the final inheritance graph is D->C->B.