diff options
author | Audun Wilhelmsen <skyfex@gmail.com> | 2015-01-02 22:12:11 +0100 |
---|---|---|
committer | Audun Wilhelmsen <skyfex@gmail.com> | 2015-01-02 22:12:11 +0100 |
commit | c461f5a8c6cbc753f47393de61e713b25e743661 (patch) | |
tree | 03281686f16d4a2876dc0713bca8f47ad6c9a855 /doc/tut2.txt | |
parent | e5bfb7d55017a0f205682f34c01ac709dcf82940 (diff) | |
parent | 5023a9043858941d311c253fd1b62017080367be (diff) | |
download | Nim-c461f5a8c6cbc753f47393de61e713b25e743661.tar.gz |
Merge branch 'devel' of https://github.com/Araq/Nim into devel
Diffstat (limited to 'doc/tut2.txt')
-rw-r--r-- | doc/tut2.txt | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/doc/tut2.txt b/doc/tut2.txt index 6e239d681..9d3409164 100644 --- a/doc/tut2.txt +++ b/doc/tut2.txt @@ -56,7 +56,7 @@ Objects have access to their type at runtime. There is an .. code-block:: nim type - TPerson = object of TObject + TPerson = object of RootObj name*: string # the * means that `name` is accessible from other modules age: int # no * means that the field is hidden from other modules @@ -76,10 +76,10 @@ never *equivalent*. New object types can only be defined within a type section. Inheritance is done with the ``object of`` syntax. Multiple inheritance is -currently not supported. If an object type has no suitable ancestor, ``TObject`` +currently not supported. If an object type has no suitable ancestor, ``RootObj`` can be used as its ancestor, but this is only a convention. Objects that have no ancestor are implicitly ``final``. You can use the ``inheritable`` pragma -to introduce new object roots apart from ``system.TObject``. (This is used +to introduce new object roots apart from ``system.RootObj``. (This is used in the GTK wrapper for instance.) @@ -228,7 +228,7 @@ is needed: .. code-block:: nim type - TSocket* = object of TObject + TSocket* = object of RootObj FHost: int # cannot be accessed from the outside of the module # the `F` prefix is a convention to avoid clashes since # the accessors are named `host` @@ -284,7 +284,7 @@ Procedures always use static dispatch. For dynamic dispatch replace the .. code-block:: nim type - PExpr = ref object of TObject ## abstract base class for an expression + PExpr = ref object of RootObj ## abstract base class for an expression PLiteral = ref object of PExpr x: int PPlusExpr = ref object of PExpr @@ -313,7 +313,7 @@ dispatching: .. code-block:: nim type - TThing = object of TObject + TThing = object of RootObj TUnit = object of TThing x: int |