aboutsummaryrefslogtreecommitdiffstats
path: root/docs/contracts.rst
diff options
context:
space:
mode:
authorErik Kundt <bitshift@posteo.org>2018-07-05 00:04:44 +0800
committerErik Kundt <bitshift@posteo.org>2018-07-17 23:44:51 +0800
commitb5ecfbe5bc2afdf8f42ec67715794aefad9dfe0f (patch)
treefc949d51bb2f84b08072ea75cae070343e875661 /docs/contracts.rst
parent1d33f41c1ab96746b97b97f79732ec23759fb8f0 (diff)
downloaddexon-solidity-b5ecfbe5bc2afdf8f42ec67715794aefad9dfe0f.tar.gz
dexon-solidity-b5ecfbe5bc2afdf8f42ec67715794aefad9dfe0f.tar.zst
dexon-solidity-b5ecfbe5bc2afdf8f42ec67715794aefad9dfe0f.zip
Enforces visibility specifier and updates docs.
Diffstat (limited to 'docs/contracts.rst')
-rw-r--r--docs/contracts.rst15
1 files changed, 7 insertions, 8 deletions
diff --git a/docs/contracts.rst b/docs/contracts.rst
index 033e9a45..51d7923d 100644
--- a/docs/contracts.rst
+++ b/docs/contracts.rst
@@ -131,10 +131,9 @@ a "message call") and external
ones that do), there are four types of visibilities for
functions and state variables.
-Functions can be specified as being ``external``,
-``public``, ``internal`` or ``private``, where the default is
-``public``. For state variables, ``external`` is not possible
-and the default is ``internal``.
+Functions have to be specified as being ``external``,
+``public``, ``internal`` or ``private``.
+For state variables, ``external`` is not possible.
``external``:
External functions are part of the contract
@@ -850,10 +849,10 @@ Details are given in the following example.
::
- pragma solidity ^0.4.22;
+ pragma solidity >0.4.24;
contract owned {
- constructor() { owner = msg.sender; }
+ constructor() public { owner = msg.sender; }
address owner;
}
@@ -862,7 +861,7 @@ Details are given in the following example.
// internal functions and state variables. These cannot be
// accessed externally via `this`, though.
contract mortal is owned {
- function kill() {
+ function kill() public {
if (msg.sender == owner) selfdestruct(owner);
}
}
@@ -884,7 +883,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 {
- constructor(bytes32 name) {
+ constructor(bytes32 name) public {
Config config = Config(0xD5f9D8D94886E70b06E474c3fB14Fd43E2f23970);
NameReg(config.lookup(1)).register(name);
}