Typehinting merge #50

Merged
belliash merged 298 commits from typehinting into master 2019-04-17 11:27:52 +02:00
2 changed files with 31 additions and 0 deletions
Showing only changes of commit 9c426b20cc - Show all commits

29
tests/factory_objects.aer Normal file
View File

@ -0,0 +1,29 @@
class Circle {
void draw() {
print("Circle\n");
}
}
class Square {
void draw() {
print("Square\n");
}
}
class Program {
object ShapeFactoryMethod(string $shape) {
switch ($shape) {
case "Circle":
return new Circle();
case "Square":
return new Square();
}
}
void main() {
$this->ShapeFactoryMethod("Circle")->draw();
$this->ShapeFactoryMethod("Square")->draw();
}
}

View File

@ -0,0 +1,2 @@
Circle
Square