mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4618 from ethereum/docs-1211-contract-type
Add contract type to types documentation
This commit is contained in:
commit
463f4b0f35
@ -200,26 +200,39 @@ The ``.gas()`` option is available on all three methods, while the ``.value()``
|
|||||||
.. note::
|
.. note::
|
||||||
The use of ``callcode`` is discouraged and will be removed in the future.
|
The use of ``callcode`` is discouraged and will be removed in the future.
|
||||||
|
|
||||||
|
.. index:: ! contract type, ! type; contract
|
||||||
|
|
||||||
|
.. _contract_types:
|
||||||
|
|
||||||
Contract Types
|
Contract Types
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
Every :ref:`contract<contracts>` defines its own type. Contracts can be implicitly converted
|
Every :ref:`contract<contracts>` defines its own type.
|
||||||
to contracts they inherit from. They can be explicitly converted from and to ``address`` types.
|
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
|
.. note::
|
||||||
this type is also used in the :ref:`ABI<ABI>`.
|
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.
|
Contracts do not support any operators.
|
||||||
|
|
||||||
The members of contract types are the external functions of the contract including
|
The members of contract types are the external functions of the contract
|
||||||
public state variables.
|
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.
|
|
||||||
|
|
||||||
.. index:: byte array, bytes32
|
.. index:: byte array, bytes32
|
||||||
|
|
||||||
|
|
||||||
Fixed-size byte arrays
|
Fixed-size byte arrays
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user