Merge pull request #4618 from ethereum/docs-1211-contract-type

Add contract type to types documentation
This commit is contained in:
chriseth 2018-08-13 16:07:29 +02:00 committed by GitHub
commit 463f4b0f35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -200,26 +200,39 @@ 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.
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.
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.
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>`.
Contracts do not support any operators.
The members of contract types are the external functions of the contract including
public state variables.
.. note::
Starting with version 0.5.0 contracts do not derive from the address type, but can still be explicitly converted to address.
The members of contract types are the external functions of the contract
including public state variables.
.. index:: byte array, bytes32
Fixed-size byte arrays
----------------------