From 5ec4f9ec6a86f69de95c3cb97bb266daca72445a Mon Sep 17 00:00:00 2001 From: Luke Date: Sun, 31 Aug 2025 17:03:00 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E4=BF=AE=E6=94=B9=20Demo29=20=E9=80=82?= =?UTF-8?q?=E9=85=8D=E6=9C=80=E6=96=B0=E8=AF=AD=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- playground/Demo/Demo29/Main.snow | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/playground/Demo/Demo29/Main.snow b/playground/Demo/Demo29/Main.snow index 774980c..458acc4 100644 --- a/playground/Demo/Demo29/Main.snow +++ b/playground/Demo/Demo29/Main.snow @@ -13,6 +13,13 @@ module: Main this.city = city end body end init + + function: getCity + returns: int + body: + return this.city + end body + end function end struct struct: Person @@ -35,6 +42,13 @@ module: Main return this.name end body end function + + function: getAddr + returns: Address + body: + return this.addr + end body + end function end struct function: main @@ -42,8 +56,9 @@ module: Main body: // 初始化 Person 和 Address 的实例 declare p: Person = new Person(123, new Address(1, 2)) + os.println(p.getName()) // 打印 name + os.println(p.getAddr().getCity()) // 打印 city - os.print(p.getName()) // 打印 name end body end function