aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorMatthew Ludwig <matthew.ludwig@drawpad.org>2018-04-21 04:50:00 +0800
committerMatthew Ludwig <matthew.ludwig@drawpad.org>2018-04-21 04:50:00 +0800
commitcf347745bd8b8636ff43d7b4893e431613bb8d84 (patch)
tree8013e23da7a9f3d2895ce5e74fb6af464bc35469 /docs
parentc8167a9acd8b558e87181a460a3c4fc148e1c43f (diff)
downloaddexon-solidity-cf347745bd8b8636ff43d7b4893e431613bb8d84.tar.gz
dexon-solidity-cf347745bd8b8636ff43d7b4893e431613bb8d84.tar.zst
dexon-solidity-cf347745bd8b8636ff43d7b4893e431613bb8d84.zip
Updated constructors and pragma solidity lines.
Updated the Inheritance section of the docs in order to correct old constructor formats and update them to the new constructor() format.
Diffstat (limited to 'docs')
-rw-r--r--docs/contracts.rst16
1 files changed, 8 insertions, 8 deletions
diff --git a/docs/contracts.rst b/docs/contracts.rst
index a1f2895c..17eb23f7 100644
--- a/docs/contracts.rst
+++ b/docs/contracts.rst
@@ -841,10 +841,10 @@ Details are given in the following example.
::
- pragma solidity ^0.4.16;
+ pragma solidity ^0.4.22;
contract owned {
- function owned() { owner = msg.sender; }
+ constructor() { owner = msg.sender; }
address owner;
}
@@ -875,7 +875,7 @@ Details are given in the following example.
// also a base class of `mortal`, yet there is only a single
// instance of `owned` (as for virtual inheritance in C++).
contract named is owned, mortal {
- function named(bytes32 name) {
+ constructor(bytes32 name) {
Config config = Config(0xD5f9D8D94886E70b06E474c3fB14Fd43E2f23970);
NameReg(config.lookup(1)).register(name);
}
@@ -913,10 +913,10 @@ Note that above, we call ``mortal.kill()`` to "forward" the
destruction request. The way this is done is problematic, as
seen in the following example::
- pragma solidity ^0.4.0;
+ pragma solidity ^0.4.22;
contract owned {
- function owned() public { owner = msg.sender; }
+ constructor() public { owner = msg.sender; }
address owner;
}
@@ -942,10 +942,10 @@ derived override, but this function will bypass
``Base1.kill``, basically because it does not even know about
``Base1``. The way around this is to use ``super``::
- pragma solidity ^0.4.0;
+ pragma solidity ^0.4.22;
contract owned {
- function owned() public { owner = msg.sender; }
+ constructor() public { owner = msg.sender; }
address owner;
}
@@ -1033,7 +1033,7 @@ Arguments for Base Constructors
Derived contracts need to provide all arguments needed for
the base constructors. This can be done in two ways::
- pragma solidity ^0.4.0;
+ pragma solidity ^0.4.22;
contract Base {
uint x;