Fund:0.024 ETH / $13.89
Question is solved

How does the constructor initialization path work with inheritance?

1 month ago

I come from a python background and this topic is a little confusing for me. What is constructor initialization path with inheritance? Does parent or child constructor get called first?


Base class constructor is invoked first before the derived class. Let’s looked at an example. Contract A { uint public value; function A() { value = 1;} } Contract B { function B() { value = 2; } }. If we deploy contract B and retrieve “value” field, it would be 2 instead of 1 because A() is called first, then B().
1 month ago

Your question is successfully refund. You will be redirect in few seconds.