I am trying to understand the order of invocation of base class constructors in the presence of multiple inheritance. As far as I can tell, the order appears under-specified in the Solidity documentation below:
http://solidity.readthedocs.io/en/develop/contracts.html#arguments-for-base-constructors http://solidity.readthedocs.io/en/develop/contracts.html#multiple-inheritance-and-linearization
I have also gone through related questions in Stackexchange, but they do not address the issue with chaining multiple base constructors.
My understanding from Remix is that order of invocation of base constructors depends on the order of inheritance of the derived contract, and does not depend on the order in the constructor. For example, in both the cases below, the constructor for B is invoked before C.
contract B {
function B() public {emit PrintB();}
event PrintB();
}
contract C {
function C() public {emit PrintC();}
event PrintC();
}
contract D is B, C {
function D() C() B() {}
}
contract E is B, C {
function E() B() C() {}
}
Can someone confirm if my understanding is correct?
If indeed my understanding is correct, is it documented in the Solidity specification, or is it just a feature of the current implementation and may change in the future.
Thanks for your help!