fork download
  1. #include <iostream>
  2.  
  3. class Pair {
  4. public:
  5. int first, second;
  6. void check() {
  7. first = 5;
  8. std::cout << "The check() method of the Pair class has executed." << std::endl;
  9. }
  10. };
  11.  
  12. Pair * pair() {
  13. Pair * pointer;
  14. pointer = new Pair;
  15. return pointer;
  16. }
  17.  
  18. int main() {
  19. Pair *p;
  20. p = pair();
  21. p->check();
  22. delete p;
  23. std::cout << "If you can see this text, the system hasn't crashed yet!" << std::endl;
  24. return 0;
  25. }
Success #stdin #stdout 0s 4300KB
stdin
Standard input is empty
stdout
The check() method of the Pair class has executed.
If you can see this text, the system hasn't crashed yet!