fork download
  1. #include <iostream>
  2.  
  3. struct D{
  4. int x;
  5. D(int a):x(a){}
  6. };
  7.  
  8. struct C{
  9. D d;
  10. C(int x=0):d(x){}
  11. operator int() { return d.x; }
  12. };
  13.  
  14. int main()
  15. {
  16.  
  17. C c;
  18. c = 1 + c;
  19. std::cout << c;
  20.  
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0s 4944KB
stdin
Standard input is empty
stdout
1