fork download
  1. // Interface declaration
  2. interface Animal
  3. {
  4. function speak(): String
  5. function move(): String
  6. }
  7. // Abstract class partially implementing Animal
  8. abstract class Mammal implements Animal
  9. {
  10. var name: String
  11.  
  12. construct(nameInput: String)
  13. {
  14. this.name = nameInput
  15. }
  16.  
  17. // Abstract method - must be implemented by subclass
  18. abstract function speak(): String;
  19.  
  20. // Concrete method
  21. function move(): String
  22. {
  23. return "${name} walks on land";
  24. };
  25. }
Success #stdin #stdout 3.47s 167004KB
stdin
Standard input is empty
stdout
Standard output is empty