trait Foo{ var x = 0 } object Main extends App{ val a = new Object() with Foo println(a.x) a.x += 1 println(a.x)}
Standard input is empty
0 1
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!