LoginSignup
11
6

More than 5 years have passed since last update.

Ethereum: Solidity v0.4.23〜 の新しいコンストラクタの書き方

Posted at

Solidity v0.4.23から、コンストラクタの書き方が新しくなりました。
それに伴い以前の記法は非推奨(deprecated)となります。

pragma solidity 0.4.23;

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

pragma solidity 0.4.23;

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

備考

v0.4.23以降では、旧コンストラクタ記法を使用すると以下のような警告が出ます。

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

最終的には新しい記法へ統一する予定のようですので、今後は新規法に統一したほうが良さそうです。 

11
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
6