mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Adjust docs example to work with v0.8.0
This commit is contained in:
@@ -39,7 +39,7 @@ Details are given in the following example.
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.9.0;
|
||||
|
||||
|
||||
contract Owned {
|
||||
@@ -127,7 +127,7 @@ destruction request. The way this is done is problematic, as
|
||||
seen in the following example::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.9.0;
|
||||
|
||||
contract owned {
|
||||
constructor() { owner = msg.sender; }
|
||||
@@ -157,7 +157,7 @@ explicitly in the final override, but this function will bypass
|
||||
``Base1.destroy``. The way around this is to use ``super``::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.9.0;
|
||||
|
||||
contract owned {
|
||||
constructor() { owner = msg.sender; }
|
||||
@@ -214,7 +214,7 @@ The following example demonstrates changing mutability and visibility:
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.9.0;
|
||||
|
||||
contract Base
|
||||
{
|
||||
@@ -238,7 +238,7 @@ bases, it has to explicitly override it:
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.9.0;
|
||||
|
||||
contract Base1
|
||||
{
|
||||
@@ -265,7 +265,7 @@ that already overrides all other functions.
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.9.0;
|
||||
|
||||
contract A { function f() public pure{} }
|
||||
contract B is A {}
|
||||
@@ -306,7 +306,7 @@ of the variable:
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.9.0;
|
||||
|
||||
contract A
|
||||
{
|
||||
@@ -338,7 +338,7 @@ and the ``override`` keyword must be used in the overriding modifier:
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.9.0;
|
||||
|
||||
contract Base
|
||||
{
|
||||
@@ -357,7 +357,7 @@ explicitly:
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
pragma solidity >=0.6.0 <0.9.0;
|
||||
|
||||
contract Base1
|
||||
{
|
||||
@@ -405,7 +405,7 @@ equivalent to ``constructor() {}``. For example:
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.9.0;
|
||||
|
||||
abstract contract A {
|
||||
uint public a;
|
||||
@@ -442,7 +442,7 @@ linearization rules explained below. If the base constructors have arguments,
|
||||
derived contracts need to specify all of them. This can be done in two ways::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.9.0;
|
||||
|
||||
contract Base {
|
||||
uint x;
|
||||
@@ -502,7 +502,7 @@ error "Linearization of inheritance graph impossible".
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.4.0 <0.8.0;
|
||||
pragma solidity >=0.4.0 <0.9.0;
|
||||
|
||||
contract X {}
|
||||
contract A is X {}
|
||||
@@ -523,7 +523,7 @@ One area where inheritance linearization is especially important and perhaps not
|
||||
::
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >0.6.99 <0.8.0;
|
||||
pragma solidity >0.6.99 <0.9.0;
|
||||
|
||||
contract Base1 {
|
||||
constructor() {}
|
||||
|
||||
Reference in New Issue
Block a user