Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@KinoAR
Created September 4, 2021 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KinoAR/850e55a646875b95ee02380c7c01e32a to your computer and use it in GitHub Desktop.
Save KinoAR/850e55a646875b95ee02380c7c01e32a to your computer and use it in GitHub Desktop.
An example of using instance properties in the Haxe programming language.
// A class; a template for creating objects with the properties listed in the class
class Duck {
public var age:Int;
public function new(age:Int) {
this.age = age;
}
}
class Test {
static function main() {
var ducky = new Duck(3);
trace(ducky.age);
// Using the instance variable to change the age
ducky.age = 4;
trace(ducky.age);
}
}
@KinoAR
Copy link
Author

KinoAR commented Sep 4, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment