Typehinting merge #50

已合并
belliash 2019-04-17 11:27:52 +02:00 将 298 次代码提交从 typehinting合并至 master
修改 2 个文件,包含 31 行新增0 行删除
仅显示提交 9c426b20cc 的更改 - 显示所有提交

29
tests/factory_objects.aer 普通文件
查看文件

@@ -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();
}
}

2
tests/factory_objects.exp 普通文件
查看文件

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