Files
wren/test/language/class/reference_nested_before_defined.wren
Bob Nystrom 8ff11a3c2c Nested classes.
A class definition can appear directly within the body of a class. It
works similar to a class variable where the class object is stored in a
field and a getter is defined on the enclosing class to return it.

Unlike class variables, nested classes do not expose setters.
2015-12-21 15:29:08 -08:00

13 lines
246 B
Plaintext

class Outer {
// TODO: Remove "this." when capitalized names are no longer top-level.
this.Inner.new() // expect runtime error: Null does not implement 'new()'.
class Inner {
construct new() {}
}
construct new() {}
}
Outer.new()