Advertisement
weberc2

Vala implementing interfaces

Apr 18th, 2013
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Vala 1.54 KB | None | 0 0
  1. /* Errors:
  2. model.vala:21.3-21.18: warning: Movable.Position.Move hides inherited method `Movable.Movable.Move'. Use the `new' keyword if hiding was intentional
  3.         public void Move (int x, int y) {
  4.         ^^^^^^^^^^^^^^^^
  5. model.vala:26.3-26.14: warning: Movable.Position.X hides inherited method `Movable.Movable.X'. Use the `new' keyword if hiding was intentional
  6.         public int X() { return x; }
  7.         ^^^^^^^^^^^^
  8. model.vala:27.3-27.14: warning: Movable.Position.Y hides inherited method `Movable.Movable.Y'. Use the `new' keyword if hiding was intentional
  9.         public int Y() { return y; }
  10.         ^^^^^^^^^^^^
  11. model.vala:12.2-12.25: error: `Movable.Position' does not implement abstract method `Movable.Movable.Move'
  12.     class Position : Movable {
  13.     ^^^^^^^^^^^^^^^^^^^^^^^^
  14. model.vala:12.2-12.25: error: `Movable.Position' does not implement abstract method `Movable.Movable.X'
  15.     class Position : Movable {
  16.     ^^^^^^^^^^^^^^^^^^^^^^^^
  17. model.vala:12.2-12.25: error: `Movable.Position' does not implement abstract method `Movable.Movable.Y'
  18.     class Position : Movable {
  19.     ^^^^^^^^^^^^^^^^^^^^^^^^
  20. Compilation failed: 3 error(s), 3 warning(s)
  21. */
  22.  
  23. namespace Movable {
  24.     abstract class Movable {
  25.         public abstract void Move (int x, int y);
  26.         public abstract int X();
  27.         public abstract int Y();
  28.     }
  29.  
  30.     class Position : Movable {
  31.         int x;
  32.         int y;
  33.        
  34.         public Position (int x, int y) {
  35.             this.x = x;
  36.             this.y = y;
  37.         }
  38.        
  39.         public void Move (int x, int y) {
  40.             this.x = x;
  41.             this.y = y;
  42.         }
  43.        
  44.         public int X() { return x; }
  45.         public int Y() { return y; }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement