diff options
author | chriseth <chris@ethereum.org> | 2017-03-22 00:54:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-22 00:54:05 +0800 |
commit | 6fb27dee635748110a27654a5a2c322d865b8578 (patch) | |
tree | 67b44c12852f074d93497d8f7129b95d89e43c73 /docs | |
parent | 2cde2f9203f05b26bc0ffa45cb77c84a991f7d76 (diff) | |
parent | 5ced3af3a0579e4e0d5e0d923b3e9d3f21197bfa (diff) | |
download | dexon-solidity-6fb27dee635748110a27654a5a2c322d865b8578.tar dexon-solidity-6fb27dee635748110a27654a5a2c322d865b8578.tar.gz dexon-solidity-6fb27dee635748110a27654a5a2c322d865b8578.tar.bz2 dexon-solidity-6fb27dee635748110a27654a5a2c322d865b8578.tar.lz dexon-solidity-6fb27dee635748110a27654a5a2c322d865b8578.tar.xz dexon-solidity-6fb27dee635748110a27654a5a2c322d865b8578.tar.zst dexon-solidity-6fb27dee635748110a27654a5a2c322d865b8578.zip |
Merge pull request #1688 from ethereum/interface-keyword
Support strict interface contracts
Diffstat (limited to 'docs')
-rw-r--r-- | docs/contracts.rst | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/docs/contracts.rst b/docs/contracts.rst index 2ee04675..28c003bd 100644 --- a/docs/contracts.rst +++ b/docs/contracts.rst @@ -922,6 +922,35 @@ Such contracts cannot be compiled (even if they contain implemented functions al If a contract inherits from an abstract contract and does not implement all non-implemented functions by overriding, it will itself be abstract. +.. index:: ! contract;interface, ! interface contract + +********** +Interfaces +********** + +Interfaces are similar to abstract contracts, but they cannot have any functions implemented. There are further restrictions: + +#. Cannot inherit other contracts or interfaces. +#. Cannot define constructor. +#. Cannot define variables. +#. Cannot define structs. +#. Cannot define enums. + +Some of these restrictions might be lifted in the future. + +Interfaces are basically limited to what the Contract ABI can represent and the conversion between the ABI and +an Interface should be possible without any information loss. + +Interfaces are denoted by their own keyword: + +:: + + interface Token { + function transfer(address recipient, uint amount); + } + +Contracts can inherit interfaces as they would inherit other contracts. + .. index:: ! library, callcode, delegatecall .. _libraries: |