aboutsummaryrefslogtreecommitdiff
path: root/doc/docs/de
diff options
context:
space:
mode:
Diffstat (limited to 'doc/docs/de')
-rw-r--r--doc/docs/de/doc/objects/object-oriented-programming.md22
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/docs/de/doc/objects/object-oriented-programming.md b/doc/docs/de/doc/objects/object-oriented-programming.md
index 706cfda..705fc08 100644
--- a/doc/docs/de/doc/objects/object-oriented-programming.md
+++ b/doc/docs/de/doc/objects/object-oriented-programming.md
@@ -40,6 +40,28 @@ Beachte, dass alle Methoden in der Klasse die Fat-Arrow-Syntax verwenden. Beim A
40 40
41Das `@`-Präfix ist Kurzform für `self.`. `@items` wird zu `self.items`. 41Das `@`-Präfix ist Kurzform für `self.`. `@items` wird zu `self.items`.
42 42
43Der Klassenblock unterstützt auch Metatable-Felder, indem Metamethod-Schlüssel in spitzen Klammern geschrieben werden, zum Beispiel `<tostring>`.
44
45```yuescript
46class User
47 new: (@name) =>
48 <tostring>: => "User(#{@name})"
49
50print tostring User "Yue"
51```
52
53<YueDisplay>
54
55```yue
56class User
57 new: (@name) =>
58 <tostring>: => "User(#{@name})"
59
60print tostring User "Yue"
61```
62
63</YueDisplay>
64
43Eine Instanz der Klasse wird erstellt, indem man den Klassennamen wie eine Funktion aufruft. 65Eine Instanz der Klasse wird erstellt, indem man den Klassennamen wie eine Funktion aufruft.
44 66
45```yuescript 67```yuescript