| 1 |
# Test non-nested/slightly nested class architecture. |
| 2 |
class Test: |
| 3 |
var number = 25 |
| 4 |
var string = "hello" |
| 5 |
|
| 6 |
|
| 7 |
class TestSub extends Test: |
| 8 |
var other_string = "bye" |
| 9 |
|
| 10 |
|
| 11 |
class TestConstructor: |
| 12 |
func _init(argument = 10): |
| 13 |
print(str("constructor with argument ", argument)) |
| 14 |
|
| 15 |
|
| 16 |
func test(): |
| 17 |
var test_instance = Test.new() |
| 18 |
test_instance.number = 42 |
| 19 |
|
| 20 |
var test_sub = TestSub.new() |
| 21 |
Utils.check(test_sub.number == 25) # From Test. |
| 22 |
Utils.check(test_sub.other_string == "bye") # From TestSub. |
| 23 |
|
| 24 |
var _test_constructor = TestConstructor.new() |
| 25 |
_test_constructor = TestConstructor.new(500) |