#include<iostream>
using namespace std;
class First{
public :
int i;
First( int z) : i( z) { } ;
First* fobj2;
void makeobject( ) { //function returns nothing, just"WORKS"
fobj2= new First( 11 ) ;
//delete fobj2;
//return fobj2.i; //i do not want the function to send it...
}
} ;
int main( ) {
First f( 8 ) ;
cout << f.i << endl;
First* po; //let's say this is ok, let it for later...
po= new First( 7 ) ;
cout << f.i << endl;
cout << po- > i<< endl;
delete po;
cout << fobj2- > i<< endl;
delete fobj2;
return 0 ;
}
I2luY2x1ZGU8aW9zdHJlYW0+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgoKY2xhc3MgRmlyc3R7CgogIHB1YmxpYzoKCiAgIGludCBpOwoKICAgIAogICAgRmlyc3QoaW50IHopIDogaSh6KSB7fTsKICAgIAogICAgRmlyc3QqIGZvYmoyOwoKICAgIHZvaWQgbWFrZW9iamVjdCgpeyAgLy9mdW5jdGlvbiByZXR1cm5zIG5vdGhpbmcsIGp1c3QiV09SS1MiCgogICAgICAgCgogICAgICAgIGZvYmoyPW5ldyBGaXJzdCgxMSk7CgogICAgICAgIC8vZGVsZXRlIGZvYmoyOwoKICAgIC8vcmV0dXJuIGZvYmoyLmk7ICAvL2kgZG8gbm90IHdhbnQgdGhlIGZ1bmN0aW9uIHRvIHNlbmQgaXQuLi4KCiAgICB9Cn07CgoKCmludCBtYWluKCl7CgogICAgRmlyc3QgZig4KTsKCiAgICBjb3V0PDxmLmk8PGVuZGw7CgogICAgCgogICAgRmlyc3QqcG87ICAgLy9sZXQncyBzYXkgdGhpcyBpcyBvaywgbGV0IGl0IGZvciBsYXRlci4uLgoKICAgIHBvPW5ldyBGaXJzdCg3KTsKCiAgICAKCiAgICBjb3V0PDxmLmk8PGVuZGw7CgogICAgY291dDw8cG8tPmk8PGVuZGw7CgogICAgZGVsZXRlIHBvOwoKICAgIAoKICAgIGNvdXQ8PGZvYmoyLT5pPDxlbmRsOwoKICAgIGRlbGV0ZSBmb2JqMjsKCiAgICAKCiAgICByZXR1cm4gMDsKCn0KCg==
compilation info
prog.cpp: In function 'int main()':
prog.cpp:53:11: error: 'fobj2' was not declared in this scope
cout<<fobj2->i<<endl;
^
prog.cpp:55:12: error: type '<type error>' argument given to 'delete', expected pointer
delete fobj2;
^
stdout