fork(1) download
  1. #include<iostream>
  2. using namespace std;
  3.  
  4.  
  5. class First{
  6.  
  7. public:
  8.  
  9. int i;
  10.  
  11.  
  12. First(int z) : i(z) {};
  13.  
  14. First* fobj2;
  15.  
  16. void makeobject(){ //function returns nothing, just"WORKS"
  17.  
  18.  
  19.  
  20. fobj2=new First(11);
  21.  
  22. //delete fobj2;
  23.  
  24. //return fobj2.i; //i do not want the function to send it...
  25.  
  26. }
  27. };
  28.  
  29.  
  30.  
  31. int main(){
  32.  
  33. First f(8);
  34.  
  35. cout<<f.i<<endl;
  36.  
  37.  
  38.  
  39. First*po; //let's say this is ok, let it for later...
  40.  
  41. po=new First(7);
  42.  
  43.  
  44.  
  45. cout<<f.i<<endl;
  46.  
  47. cout<<po->i<<endl;
  48.  
  49. delete po;
  50.  
  51.  
  52.  
  53. cout<<f.fobj2->i<<endl;
  54.  
  55. delete f.fobj2;
  56.  
  57.  
  58.  
  59. return 0;
  60.  
  61. }
  62.  
  63.  
Runtime error #stdin #stdout 0s 3272KB
stdin
Standard input is empty
stdout
8
8
7