From 29db60797bd74656b57a0f20778c76adc78095ac Mon Sep 17 00:00:00 2001 From: Li Jin Date: Sat, 28 Feb 2026 18:03:14 +0800 Subject: Fixed destructuring with empty and comment lines in table issue. Updated docs. --- .../de/doc/objects/object-oriented-programming.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'doc/docs/de') 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 Das `@`-Präfix ist Kurzform für `self.`. `@items` wird zu `self.items`. +Der Klassenblock unterstützt auch Metatable-Felder, indem Metamethod-Schlüssel in spitzen Klammern geschrieben werden, zum Beispiel ``. + +```yuescript +class User + new: (@name) => + : => "User(#{@name})" + +print tostring User "Yue" +``` + + + +```yue +class User + new: (@name) => + : => "User(#{@name})" + +print tostring User "Yue" +``` + + + Eine Instanz der Klasse wird erstellt, indem man den Klassennamen wie eine Funktion aufruft. ```yuescript -- cgit v1.2.3-55-g6feb