Skip to content
loading...

Ethereum:New Solidity constructor

twitter logo github logo ・1 min read  

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.
twitter logo DISCUSS (2)
Classic DEV Post from Apr 7

Tell us what your top unpopular tech opinion is 😈

DEV is in the process of launching a podcast and we'd love for you to be involved! We're recording th...

sot528 profile image
CTO of the ALIS(https://alismedia.jp)。

DARK MODE

Go to the "UX" section of your settings and select night theme ❤️