Advertisement
Guest User

Untitled

a guest
Jun 17th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.48 KB | None | 0 0
  1. module test;
  2.  
  3. import tango.io.Stdout;
  4.  
  5. struct Point
  6. {
  7.     int x;
  8.     int y;
  9. }
  10.  
  11. class Foo
  12. {
  13.     private Point point_;
  14.    
  15.     Point point (Point point)
  16.     {
  17.         return point_ = point;
  18.     }
  19.    
  20.     Point point ()
  21.     {
  22.         return point_;
  23.     }
  24. }
  25.  
  26. class Bar
  27. {
  28.     Point point;
  29. }
  30.  
  31. void main ()
  32. {
  33.     auto foo = new Foo;
  34.     foo.point.x = 3;
  35.    
  36.     auto bar = new Bar;
  37.     bar.point.x = 3;
  38.    
  39.     Stdout.formatln("foo.point.x={}, bar.point.x={}", foo.point.x, bar.point.x); // prints foo.point.x=0, bar.point.x=3
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement