Add interface tests (OOP).
Alle checks waren succesvol
The build was successful.

This commit is contained in:
Rafal Kupiec 2019-04-06 16:02:20 +02:00
bovenliggende 1fd161e394
commit bda8316e1b
Getekend door: belliash
GPG sleutel-ID: 4E829243E0CFE6B4
2 gewijzigde bestanden met toevoegingen van 46 en 0 verwijderingen

42
tests/interface_test.aer Normal file
Bestand weergeven

@ -0,0 +1,42 @@
interface iVehicle {
public void drive();
public void stop();
}
class Car implements iVehicle {
public void drive() {
print("Driving...\n");
}
public void stop() {
print("Stopping...\n");
}
}
class MyCar extends Car {
public void drive() {
print("Driving my car...\n");
}
}
class Program {
public void driveCar(iVehicle $vehicle) {
$vehicle->drive();
$vehicle->stop();
}
public void main() {
object $car = new Car();
object $mycar = new MyCar();
$this->driveCar($car);
$this->driveCar($mycar);
}
}

4
tests/interface_test.exp Normal file
Bestand weergeven

@ -0,0 +1,4 @@
Driving...
Stopping...
Driving my car...
Stopping...