From 91708bb21dfea35e178186f8820c7972d3832a67 Mon Sep 17 00:00:00 2001 From: def Date: Thu, 26 Mar 2015 15:59:26 +0100 Subject: [PATCH] Add explanation why we use ref objects --- doc/tut2.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/tut2.txt b/doc/tut2.txt index f5089566c6..7440036850 100644 --- a/doc/tut2.txt +++ b/doc/tut2.txt @@ -83,6 +83,9 @@ no ancestor are implicitly ``final``. You can use the ``inheritable`` pragma to introduce new object roots apart from ``system.RootObj``. (This is used in the GTK wrapper for instance.) +We always use ref objects for inheritance in this tutorial. When you store a +non-ref object in a variable of a parent type, the additional fields are cut +off. **Note**: Composition (*has-a* relation) is often preferable to inheritance (*is-a* relation) for simple code reuse. Since objects are value types in