Aer Interpreter Source
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

24 lines
451 B

class Dog {
public string $name;
public string $color;
public void __construct(string $name, string $color) {
$this->name = $name;
$this->color = $color;
}
public callback greet(string $greeting) {
return void() using ($greeting) {
print("$greeting, I am a {$this->color} dog named {$this->name}\n");
};
}
}
class Program {
void main() {
object $dog = new Dog('Alex', 'red');
callback $c = $dog->greet('Hello');
$c();
}
}