fork download
  1. #include <iostream>
  2. using namespace std;
  3. class Simple
  4. {
  5. public:
  6. Simple()
  7. {
  8. mIntPtr = new int();
  9. }
  10. ~Simple()
  11. {
  12. delete mIntPtr;
  13. }
  14. void setIntPtr(int inInt)
  15. {
  16. *mIntPtr = inInt;
  17. }
  18. void go()
  19. {
  20. cout << "Herllo there" << endl;
  21. }
  22. protected:
  23. int* mIntPtr;
  24. };
  25. void doSomething(Simple*& outSimplePtr)
  26. {
  27. outSimplePtr = new Simple();
  28. }
  29.  
  30. int main(int argc, char** argv) {
  31. Simple* simplePtr = new Simple();
  32. doSomething(simplePtr);
  33. delete simplePtr;
  34. }
Success #stdin #stdout 0.01s 5504KB
stdin
2
stdout
Standard output is empty