diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/contracts.rst | 14 | ||||
-rw-r--r-- | docs/solidity-by-example.rst | 9 |
2 files changed, 13 insertions, 10 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 diff --git a/docs/solidity-by-example.rst b/docs/solidity-by-example.rst index 27fefd49..3636a332 100644 --- a/docs/solidity-by-example.rst +++ b/docs/solidity-by-example.rst @@ -89,11 +89,10 @@ of votes. function giveRightToVote(address voter) public { // If the argument of `require` evaluates to `false`, // it terminates and reverts all changes to - // the state and to Ether balances. It is often - // a good idea to use this if functions are - // called incorrectly. But watch out, this - // will currently also consume all provided gas - // (this is planned to change in the future). + // the state and to Ether balances. + // This consumes all gas in old EVM versions, but not anymore. + // It is often a good idea to use this if functions are + // called incorrectly. require( (msg.sender == chairperson) && !voters[voter].voted && |