Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct test
- {
- test()
- {
- x = 0, y = 0;
- }
- test *echo()
- {
- cout << "Values are " << x << " " << y << endl;
- return this;
- }
- test *setX(float n) { x = n; return this; }
- test *setY(float n) { y = n; return this; }
- float x, y;
- };
- int main()
- {
- test *n = new test();
- n->echo()->setX(1.0f)->echo()->setY(3.6f)->echo();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement