fork download
  1. class Foo
  2. {
  3. private:
  4. struct Bar
  5. {
  6. int a;
  7. char b;
  8.  
  9. Bar& operator+=(const Bar& rhs)
  10. {
  11. a += rhs.a;
  12. return *this;
  13. }
  14. };
  15.  
  16. friend Bar operator+(const Bar& lhs, const Bar& rhs)
  17. {
  18. Bar ret = lhs;
  19. ret += rhs;
  20. return ret;
  21. }
  22.  
  23. public:
  24. void foo() const
  25. {
  26. Bar b0, b1;
  27. Bar b2 = b0 + b1;
  28. }
  29. };
  30.  
  31.  
  32. int main()
  33. {
  34. Foo f;
  35. f.foo();
  36. }
Success #stdin #stdout 0s 3292KB
stdin
Standard input is empty
stdout
Standard output is empty