@:structInit class User { final name:String; var age:Int = 30; public function new(name:String, age:Int) { this.name = name; this.age = age; } public function greet() trace( 'Hello, I\'m $name, and I\'m $age years old!'); }