From 4f753233f7b460504a007d94886ab34641ba86ca Mon Sep 17 00:00:00 2001 From: ZoOgY-DoOgY Date: Wed, 24 Jan 2018 13:38:47 +0100 Subject: Inheritance, "super" and DDD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As explained in "Multiple Inheritance and Linearization" part, "a simple rule to remember is to specify the base classes in the order from “most base-like” to “most derived”". So "contract Final is Base1, Base2" means Final is derived from Base2, derived from Base1, so the final inheritance sequence should be, starting with the most derived contract : Final, Base2, Base1, mortal, owned. --- docs/contracts.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs/contracts.rst') diff --git a/docs/contracts.rst b/docs/contracts.rst index 273ea43a..a8ea8378 100644 --- a/docs/contracts.rst +++ b/docs/contracts.rst @@ -942,12 +942,12 @@ derived override, but this function will bypass contract Final is Base1, Base2 { } -If ``Base1`` calls a function of ``super``, it does not simply +If ``Base2`` calls a function of ``super``, it does not simply call this function on one of its base contracts. Rather, it calls this function on the next base contract in the final -inheritance graph, so it will call ``Base2.kill()`` (note that +inheritance graph, so it will call ``Base1.kill()`` (note that the final inheritance sequence is -- starting with the most -derived contract: Final, Base1, Base2, mortal, owned). +derived contract: Final, Base2, Base1, mortal, owned). The actual function that is called when using super is not known in the context of the class where it is used, although its type is known. This is similar for ordinary -- cgit