fork download
  1. #include <iostream>
  2.  
  3. class foo
  4. {
  5. public:
  6. int val;
  7.  
  8. foo (int i) : val(i) {}
  9.  
  10. bool operator < (const foo &other);
  11. };
  12.  
  13. bool foo::operator < (const foo &other)
  14. {
  15. return val < other.val;
  16. }
  17.  
  18. int main()
  19. {
  20. foo f(5), g(4);
  21. std::cout << std::boolalpha << (f < g) << '-' << (g < f);
  22. }
  23.  
  24.  
  25.  
Success #stdin #stdout 0s 2896KB
stdin
Standard input is empty
stdout
false-true