Logo

dev-resources.site

for different kinds of informations.

Ethereum:New Solidity constructor

Published at
5/19/2018
Categories
ethereum
solidity
Author
sot528
Categories
2 categories in total
ethereum
open
solidity
open
Ethereum:New Solidity constructor

Since Solidity v0.4.23, Solidity has new constructor notation.

And The old one was deprecated.

Old

pragma solidity 0.4.23;

contract Foo {
  function Foo() public {
    // ...
  }
}

New

pragma solidity 0.4.23;

contract Foo {
  constructor() public {
    // ...
  }
}

Note

The old one raise below.

Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.

Featured ones: