diff options
author | Federico Bond <federicobond@gmail.com> | 2017-12-12 05:00:15 +0800 |
---|---|---|
committer | Daniel Kirchner <daniel@ekpyron.org> | 2018-04-09 17:22:35 +0800 |
commit | 4e037281acaf74c907f68e6227d6aa1b8847c78d (patch) | |
tree | 1317b5018a7b91d24578d16d1f6f6a2780c01771 /docs | |
parent | fe61435c273bf43ac1a20d8bc97b6935a54b7117 (diff) | |
download | dexon-solidity-4e037281acaf74c907f68e6227d6aa1b8847c78d.tar dexon-solidity-4e037281acaf74c907f68e6227d6aa1b8847c78d.tar.gz dexon-solidity-4e037281acaf74c907f68e6227d6aa1b8847c78d.tar.bz2 dexon-solidity-4e037281acaf74c907f68e6227d6aa1b8847c78d.tar.lz dexon-solidity-4e037281acaf74c907f68e6227d6aa1b8847c78d.tar.xz dexon-solidity-4e037281acaf74c907f68e6227d6aa1b8847c78d.tar.zst dexon-solidity-4e037281acaf74c907f68e6227d6aa1b8847c78d.zip |
Error on duplicated super constructor calls
Diffstat (limited to 'docs')
-rw-r--r-- | docs/contracts.rst | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/docs/contracts.rst b/docs/contracts.rst index f8a44fb3..0dd9845c 100644 --- a/docs/contracts.rst +++ b/docs/contracts.rst @@ -1034,9 +1034,12 @@ the base constructors. This can be done in two ways:: constructor(uint _x) public { x = _x; } } - contract Derived is Base(7) { - constructor(uint _y) Base(_y * _y) public { - } + contract Derived1 is Base(7) { + constructor(uint _y) public {} + } + + contract Derived2 is Base { + constructor(uint _y) Base(_y * _y) public {} } One way is directly in the inheritance list (``is Base(7)``). The other is in @@ -1046,8 +1049,9 @@ do it is more convenient if the constructor argument is a constant and defines the behaviour of the contract or describes it. The second way has to be used if the constructor arguments of the base depend on those of the -derived contract. If, as in this silly example, both places -are used, the modifier-style argument takes precedence. +derived contract. Arguments have to be given either in the +inheritance list or in modifier-style in the derived constuctor. +Specifying arguments in both places is an error. .. index:: ! inheritance;multiple, ! linearization, ! C3 linearization |