Created
August 31, 2021 21:44
-
-
Save KinoAR/b0bdff58893555e85d9e1da1cbd8a888 to your computer and use it in GitHub Desktop.
An example of Struct Init usage within the Haxe programming language.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@:structInit class Person { | |
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!'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment