aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-08-13 22:07:29 +0800
committerGitHub <noreply@github.com>2018-08-13 22:07:29 +0800
commit463f4b0f35a9eb930a4cce164135d726c091c50e (patch)
treeffcda866645561d6c9ec3a5d492261514022c5a9 /docs
parent23789482280217806a2738c413e3ef1b4afba1d6 (diff)
parent631794b72e6bb8c590368d2a2bd6eec9a31cc2e2 (diff)
downloaddexon-solidity-463f4b0f35a9eb930a4cce164135d726c091c50e.tar
dexon-solidity-463f4b0f35a9eb930a4cce164135d726c091c50e.tar.gz
dexon-solidity-463f4b0f35a9eb930a4cce164135d726c091c50e.tar.bz2
dexon-solidity-463f4b0f35a9eb930a4cce164135d726c091c50e.tar.lz
dexon-solidity-463f4b0f35a9eb930a4cce164135d726c091c50e.tar.xz
dexon-solidity-463f4b0f35a9eb930a4cce164135d726c091c50e.tar.zst
dexon-solidity-463f4b0f35a9eb930a4cce164135d726c091c50e.zip
Merge pull request #4618 from ethereum/docs-1211-contract-type
Add contract type to types documentation
Diffstat (limited to 'docs')
-rw-r--r--docs/types.rst33
1 files changed, 23 insertions, 10 deletions
diff --git a/docs/types.rst b/docs/types.rst
index bcd3ce9c..5efb24e3 100644
--- a/docs/types.rst
+++ b/docs/types.rst
@@ -200,25 +200,38 @@ The ``.gas()`` option is available on all three methods, while the ``.value()``
.. note::
The use of ``callcode`` is discouraged and will be removed in the future.
+.. index:: ! contract type, ! type; contract
+
+.. _contract_types:
+
Contract Types
--------------
-Every :ref:`contract<contracts>` defines its own type. Contracts can be implicitly converted
-to contracts they inherit from. They can be explicitly converted from and to ``address`` types.
+Every :ref:`contract<contracts>` defines its own type.
+You can implicitly convert contracts to contracts they inherit from,
+and explicitly convert them to and from the ``address`` type.
-The data representation of a contract is identical to that of the ``address`` type and
-this type is also used in the :ref:`ABI<ABI>`.
+.. note::
+ Starting with version 0.5.0 contracts do not derive from the address type,
+ but can still be explicitly converted to address.
-Contracts do not support any operators.
+If you declare a local variable of contract type (`MyContract c`), you can call
+functions on that contract. Take care to assign it from somewhere that is the
+same contract type.
-The members of contract types are the external functions of the contract including
-public state variables.
+You can also instantiate contracts (which means they are newly created). You
+can find more details in the :ref:`'Contracts via new'<creating-contracts>`
+section.
-.. note::
- Starting with version 0.5.0 contracts do not derive from the address type, but can still be explicitly converted to address.
+The data representation of a contract is identical to that of the ``address``
+type and this type is also used in the :ref:`ABI<ABI>`.
-.. index:: byte array, bytes32
+Contracts do not support any operators.
+The members of contract types are the external functions of the contract
+including public state variables.
+
+.. index:: byte array, bytes32
Fixed-size byte arrays
----------------------