Inheritance in constructor in solidity

Thanks to grandzero

Code:https://github.com/grandzero/SecureumBootcamp/blob/main/solidity101/contracts/Constructor.sol

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

--

--

Solidity Programming Language

Solidity basics for beginners: Learn the fundamentals of smart contract development and build your first DApp! #Solidity #Foundry #Ethereum #Opcodes #DApps