fork download
  1. struct A {
  2. int a;
  3. bool operator>(const int& inty) { return a > inty; }
  4. friend bool less(A& foo, const int y);
  5. };
  6.  
  7. /*template <class A, class B> bool operator<(const A& a, const B& b)
  8. { return a < b; }*/
  9.  
  10. bool less(struct A& foo, const int y)
  11. {
  12. return A.less(foo, y);
  13. }
  14.  
  15. int main(void) {
  16. A a; a.a = 1;
  17. int b = 2;
  18. if (less(a,b))
  19. return 4;
  20. return 0;
  21. }
  22.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'bool less(A&, int)':
prog.cpp:12:10: error: expected primary-expression before '.' token
stdout
Standard output is empty