# Test of C# idiom for Java-like implicit enclosure ref for nested classes. # as per http://blogs.msdn.com/oldnewthing/archive/2006/08/01/685248.aspx class Enclosing var s as String = 'no-thing' class Nested var _parent cue init(parent) # Java does this implicitly base.init _parent = parent def getS as String return _parent.s def mkNested as Nested return Enclosing.Nested(this) def main e = Enclosing() n = Enclosing.Nested(e) n1 = e.Nested(e) assert n.getS == 'no-thing' assert n1.getS == 'no-thing' n2 = e.mkNested assert n2.getS == 'no-thing' delta = 'activated' e.s = delta assert n.getS == delta assert n1.getS == delta assert n2.getS == delta assert n <> n1 assert n <> n2 assert n1 <> n2