Focus mode

Smart Contract Development with Solidity

Constructor

Code from video: https://solidity-by-example.org/constructor/ 

You can access the video content in Turkish prepared by İTÜ Blockchain here (between 00:00 - 4:30 minutes): https://youtu.be/XQR2tL4v0_c

A constructor is a special method in any object-oriented programming language that gets called and will run once a new instance of the object is created.

It is called automatically once the contract is created and starts executing in the blockchain.

In case of Solidity, the code defined inside the constructor will run only once, at the time the contract is created and deployed in the network. A default constructor is created by the compiler if there is no explicitly defined constructor.

Resources:

You can find detailed further information from Solidity Official documentation (in English): 

https://docs.soliditylang.org/en/v0.8.15/contracts.html#creating-contracts 

https://www.tutorialspoint.com/solidity/solidity_constructors.htm 

https://www.geeksforgeeks.org/solidity-constructors/

Test

Comments

You need to enroll in the course to be able to comment!