diff options
Diffstat (limited to 'docs/contracts.rst')
-rw-r--r-- | docs/contracts.rst | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/docs/contracts.rst b/docs/contracts.rst index 17eb23f7..5c298274 100644 --- a/docs/contracts.rst +++ b/docs/contracts.rst @@ -1066,12 +1066,15 @@ Multiple Inheritance and Linearization Languages that allow multiple inheritance have to deal with several problems. One is the `Diamond Problem <https://en.wikipedia.org/wiki/Multiple_inheritance#The_diamond_problem>`_. -Solidity follows the path of Python and uses "`C3 Linearization <https://en.wikipedia.org/wiki/C3_linearization>`_" +Solidity is similar to Python in that it uses "`C3 Linearization <https://en.wikipedia.org/wiki/C3_linearization>`_" to force a specific order in the DAG of base classes. This results in the desirable property of monotonicity but disallows some inheritance graphs. Especially, the order in which the base classes are given in the ``is`` directive is -important. In the following code, Solidity will give the +important: You have to list the direct base contracts +in the order from "most base-like" to "most derived". +Note that this order is different from the one used in Python. +In the following code, Solidity will give the error "Linearization of inheritance graph impossible". :: @@ -1089,9 +1092,6 @@ The reason for this is that ``C`` requests ``X`` to override ``A`` requests to override ``X``, which is a contradiction that cannot be resolved. -A simple rule to remember is to specify the base classes in -the order from "most base-like" to "most derived". - Inheriting Different Kinds of Members of the Same Name ====================================================== |