From d26504721dd264b439b6d00d8fd3f08c444ae305 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Thu, 4 Jan 2018 12:29:13 +0200 Subject: [PATCH] Add benefits of abstraction to documentation --- docs/contracts.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/contracts.rst b/docs/contracts.rst index 405e51e609ae..aae188738a17 100644 --- a/docs/contracts.rst +++ b/docs/contracts.rst @@ -1056,7 +1056,8 @@ As an exception, a state variable getter can override a public function. Abstractions ************ -An abstraction type describes a contract but does not provide a full implementation of the contract. An abstraction is implemented as either an abstract contract or interface. +An abstraction type describes a contract but does not provide a full implementation of the contract. An abstraction is implemented as abstract contract or interface. +An abstraction allows you to decouple contract definition from implementation providing better extensibility and self-documentation. .. index:: ! contract;abstract, ! abstract contract @@ -1085,7 +1086,8 @@ 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. +Abstract contracts can implement most of a contract, but leave some methods abstract, facilitating patterns like template method 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