Inheritance in constructor in solidity


Thanks to grandzero


I little change the contract names.

contract ParentConstructor{

uint256 public parentValue;

constructor(uint256 _parentValue){parentValue = _parentValue;}}

contract ChildConstructor is ParentConstructor(300){

uint256 public childState;

constructor(uint256 childValue){childState = childValue;}}

We deploy ParentConstructor with “100” value.

We click blue button and take the result

Now, We deploy the ChildConstructor with “200” value and remember that

contract ChildConstructor is ParentConstructor(11)

Time to see the results