Browse Source

Add another test - constructor overloading.

release/v0.1
Rafal Kupiec 1 year ago
parent
commit
58618a4d27
Signed by: belliash GPG Key ID: 4E829243E0CFE6B4
2 changed files with 20 additions and 0 deletions
  1. +18
    -0
      tests/overloading_constructor.aer
  2. +2
    -0
      tests/overloading_constructor.exp

+ 18
- 0
tests/overloading_constructor.aer View 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
- 0
tests/overloading_constructor.exp View File

@ -0,0 +1,2 @@
Hello world!
4 + 7 = 11

Loading…
Cancel
Save