Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
0
Help us understand the problem. What is going on with this article?
@_akira19

Solidityで親要素のコンストラクタに引数を渡す方法

More than 1 year has passed since last update.

Solidityでは継承元のコンストラクタに引数を渡す方法が2つあります。

contract Parent {
    uint x;
    constructor(uint _x) public { x = _x; }
}

// 直接継承元に引数を渡す方法
contract Chaild1 is Parent(7) {
    constructor() public {}
}

// modifierで親要素のコンストラクタに引数を渡す方法
contract Chaild2 is Parent {
    constructor(uint _y) Parent(_y) public {}
}

引数を渡さなければそのまま抽象化となります。

詳しくはSolidity公式ドキュメント最新版(v0.5.4)を参照してください。

0
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
_akira19
Twitter: @_akira19
bajji
2019年創業のスタートアップ 。感情日記SNS『Feelyou(フィールユー)』、ブロックチェーンを活用したSNS『bajji(バッジ)』を開発しています。

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
0
Help us understand the problem. What is going on with this article?