[ create a new paste ] login | about

Link: http://codepad.org/TngFTgg7    [ raw code | output | fork ]

C++, pasted on May 5:
#include <iostream>

class A
{
public:

  const A& foo(int x) const  { return *this; }
  const A& operator<<(int x) const  { return *this; }
};

int f(int x) 
{ 
  std::cout << x << std::endl; 
  return x;
}

int main()
{
  A a;

  a.foo(f(1)).foo(f(2)).foo(f(3));
  a << f(4) << f(5) << f(6);
}


Output:
1
2
3
4
5
6
3
2
1
6
5
4


Create a new paste based on this one


Comments: