mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Enforces visibility specifier and updates docs.
This commit is contained in:
+7
-8
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user