Skip to content

Commit

Permalink
Add benefits of abstraction to documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
elenadimitrova committed Feb 28, 2018
1 parent 4b5bebb commit 9069be2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/contracts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1078,8 +1078,6 @@ Such contracts cannot be compiled (even if they contain implemented functions al
function utterance() public returns (bytes32) { return "miaow"; }
}

If a contract inherits from an abstract contract and does not implement all non-implemented functions by overriding, it will itself be abstract.

Note that a function without implementation is different from a :ref:`Function Type <function_types>` even though their syntax looks very similar.

Example of function without implementation (a function declaration)::
Expand All @@ -1090,6 +1088,9 @@ Example of a Function Type (a variable declaration, where the variable is of typ

function(address) external returns (address) foo;

Abstract contracts allow you to decouple contract definition from implementation providing better extensibility and self-documentation and
facilitating patterns like `Template method <https://en.wikipedia.org/wiki/Template_method_pattern>`_ and removing code duplication.
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

Expand Down

0 comments on commit 9069be2

Please sign in to comment.