Advertisement
Guest User

cs example

a guest
Apr 14th, 2015
423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Point
  2. {
  3.   var x;
  4.   var y;
  5.   def Point(x, y)
  6.   {
  7.     this.x = x;
  8.     this.y = y;
  9.   }
  10.   def to_string()
  11.   {
  12.     return ("[" + this.x.to_string() + ", " + this.y.to_string() + "]");
  13.   }
  14. }
  15.  
  16. /*
  17.     Usage
  18. */
  19. var p = Point(13, 32);
  20. print(p.x.to_string());
  21. print(p.y.to_string());
  22. print(p.to_string());
  23.  
  24. /*
  25.   Output:
  26. >> 13
  27. >> 32
  28. >> [13, 32]
  29. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement