fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class test{
  5. public:
  6. test(int i);
  7. ~test();
  8. int* getint();
  9. private:
  10. int *asdf;
  11. };
  12.  
  13. test::test(int i){
  14. asdf = new int();
  15. *asdf = i;
  16. }
  17.  
  18. int* test::getint(){
  19. return asdf;
  20. }
  21.  
  22. void fun1(int* i){
  23. *i +=1;
  24. }
  25.  
  26. int main(){
  27. test *a = new test(1);
  28. fun1(a->getint());
  29.  
  30. cout << *(a->getint());
  31. }
Success #stdin #stdout 0.02s 2812KB
stdin
Standard input is empty
stdout
2