Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. struct test
  2. {
  3.     test()
  4.     {
  5.         x = 0, y = 0;
  6.     }
  7.     test *echo()
  8.     {
  9.         cout << "Values are " << x << " " << y << endl;
  10.         return this;
  11.     }
  12.     test *setX(float n) { x = n; return this; }
  13.     test *setY(float n) { y = n; return this; }
  14.     float x, y;
  15. };
  16.  
  17. int main()
  18. {
  19.     test *n = new test();
  20.     n->echo()->setX(1.0f)->echo()->setY(3.6f)->echo();
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement