aboutsummaryrefslogtreecommitdiffstats
path: root/docs/contracts.rst
diff options
context:
space:
mode:
Diffstat (limited to 'docs/contracts.rst')
-rw-r--r--docs/contracts.rst36
1 files changed, 10 insertions, 26 deletions
diff --git a/docs/contracts.rst b/docs/contracts.rst
index 845fd973..56d651ee 100644
--- a/docs/contracts.rst
+++ b/docs/contracts.rst
@@ -301,10 +301,10 @@ inheritable properties of contracts and may be overridden by derived contracts.
::
- pragma solidity ^0.4.22;
+ pragma solidity >0.4.24;
contract owned {
- function owned() public { owner = msg.sender; }
+ constructor() public { owner = msg.sender; }
address owner;
// This contract only defines a modifier but does not use
@@ -346,7 +346,7 @@ inheritable properties of contracts and may be overridden by derived contracts.
mapping (address => bool) registeredAddresses;
uint price;
- function Register(uint initialPrice) public { price = initialPrice; }
+ constructor(uint initialPrice) public { price = initialPrice; }
// It is important to also provide the
// `payable` keyword here, otherwise the function will
@@ -990,7 +990,7 @@ default constructor: ``contructor() public {}``.
::
- pragma solidity ^0.4.22;
+ pragma solidity >0.4.24;
contract A {
uint public a;
@@ -1006,24 +1006,8 @@ default constructor: ``contructor() public {}``.
A constructor set as ``internal`` causes the contract to be marked as :ref:`abstract <abstract-contract>`.
-.. note ::
- Prior to version 0.4.22, constructors were defined as functions with the same name as the contract. This syntax is now deprecated.
-
-::
-
- pragma solidity ^0.4.11;
-
- contract A {
- uint public a;
-
- function A(uint _a) internal {
- a = _a;
- }
- }
-
- contract B is A(1) {
- function B() public {}
- }
+.. warning ::
+ Prior to version 0.4.22, constructors were defined as functions with the same name as the contract. This syntax was deprecated and is not allowed anymore in version 0.5.0.
.. index:: ! base;constructor
@@ -1344,9 +1328,9 @@ custom types without the overhead of external function calls:
using BigInt for BigInt.bigint;
function f() public pure {
- var x = BigInt.fromUint(7);
- var y = BigInt.fromUint(uint(-1));
- var z = x.add(y);
+ BigInt.bigint memory x = BigInt.fromUint(7);
+ BigInt.bigint memory y = BigInt.fromUint(uint(-1));
+ BigInt.bigint memory z = x.add(y);
}
}
@@ -1402,7 +1386,7 @@ Using For
*********
The directive ``using A for B;`` can be used to attach library
-functions (from the library ``A``) to any type (``B``).
+functions (from the library ``A``) to any type (``B``).
These functions will receive the object they are called on
as their first parameter (like the ``self`` variable in Python).