mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
abstract-contracts.rst: Clarify when a contract may or must be marked abstract
This commit is contained in:
parent
5f4c91cc6d
commit
6f4844648f
@ -6,12 +6,15 @@
|
|||||||
Abstract Contracts
|
Abstract Contracts
|
||||||
******************
|
******************
|
||||||
|
|
||||||
Contracts need to be marked as abstract when at least one of their functions is not implemented.
|
Contracts must be marked as abstract when at least one of their functions is not implemented or when
|
||||||
Contracts may be marked as abstract even though all functions are implemented.
|
they do not provide arguments for all of their base contract constructors.
|
||||||
|
Even if this is not the case, a contract may still be marked abstract, such as when you do not intend
|
||||||
|
for the contract to be created directly. Abstract contracts are similar to :ref:`interfaces` but an
|
||||||
|
interface is more limited in what it can declare.
|
||||||
|
|
||||||
This can be done by using the ``abstract`` keyword as shown in the following example. Note that this contract needs to be
|
An abstract contract is declared using the ``abstract`` keyword as shown in the following example.
|
||||||
defined as abstract, because the function ``utterance()`` was defined, but no implementation was
|
Note that this contract needs to be defined as abstract, because the function ``utterance()`` is declared,
|
||||||
provided (no implementation body ``{ }`` was given).
|
but no implementation was provided (no implementation body ``{ }`` was given).
|
||||||
|
|
||||||
.. code-block:: solidity
|
.. code-block:: solidity
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user