Aer Interpreter Source
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
542 B

  1. interface iVehicle {
  2. public void drive();
  3. public void stop();
  4. }
  5. class Car implements iVehicle {
  6. public void drive() {
  7. print("Driving...\n");
  8. }
  9. public void stop() {
  10. print("Stopping...\n");
  11. }
  12. }
  13. class MyCar extends Car {
  14. public void drive() {
  15. print("Driving my car...\n");
  16. }
  17. }
  18. class Program {
  19. public void driveCar(iVehicle $vehicle) {
  20. $vehicle->drive();
  21. $vehicle->stop();
  22. }
  23. public void main() {
  24. object $car = new Car();
  25. object $mycar = new MyCar();
  26. $this->driveCar($car);
  27. $this->driveCar($mycar);
  28. }
  29. }