fork download
  1. #include <iostream>
  2.  
  3. void launch_nukes() {
  4. std::cout << "Boom!" << std::endl;
  5. }
  6.  
  7. class SideEffects {
  8. int x;
  9. public:
  10. SideEffects(int x_ = 0) : x(x_) {}
  11.  
  12. operator int() {
  13. launch_nukes();
  14. return x;
  15. }
  16. };
  17.  
  18. int main() {
  19. SideEffects variable(5);
  20.  
  21. int x = variable;
  22. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
Boom!