constructor in solidity

The solution for “constructor in solidity” can be found here. The following code will assist you in solving the problem.

contract Will {
address owner;
uint fortune;
bool deceased;
//constructor is special function that’s going to execute
//when we deploy our solidity
//payable is the function that allow send or recieve ethers
constructor() payable public {
owner= msg.sender; // msg.sender represents address that is being called
fortune=msg.value; //msg.value tells us how much ether is being sent
//create modifier so the only person who can call the contract is the owner

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

Similar Posts