This commit is contained in:
父節點
9a82298451
當前提交
58618a4d27
18
tests/overloading_constructor.aer
Normal file
18
tests/overloading_constructor.aer
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
class Test {
|
||||||
|
object __construct(string $a) {
|
||||||
|
print("$a\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
object __construct(int $a, int $b) {
|
||||||
|
print("$a + $b = ", $a + $b, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class Program {
|
||||||
|
void main() {
|
||||||
|
object $a, $b;
|
||||||
|
$a = new Test('Hello world!');
|
||||||
|
$b = new Test(4, 7);
|
||||||
|
}
|
||||||
|
}
|
2
tests/overloading_constructor.exp
Normal file
2
tests/overloading_constructor.exp
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Hello world!
|
||||||
|
4 + 7 = 11
|
載入中…
新增問題並參考
Block a user