Created
July 4, 2011 13:51
-
-
Save benben/1063354 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <map> | |
#include <string> | |
#include <vector> | |
using namespace std; | |
class Object | |
{ | |
public: | |
Object(); | |
~Object(); | |
}; | |
Object::Object() | |
{ | |
} | |
Object::~Object() | |
{ | |
} | |
class Connection | |
{ | |
public: | |
Connection(Object _obj); | |
~Connection(); | |
Object * obj; | |
void status(); | |
}; | |
Connection::Connection(Object _obj) | |
{ | |
obj = _obj; | |
} | |
Connection::~Connection() | |
{ | |
} | |
void Connection::status() | |
{ | |
cout << obj << endl; | |
} | |
int main() { | |
Object * myObj = new Object(); | |
Connection * myConn = new Connection(myObj); | |
delete myObj; | |
myObj = NULL; | |
cout << myObj << endl; | |
myConn->status(); | |
/* | |
Ausgabe ist: | |
0 | |
0x25ec010 | |
sollte aber: | |
0 | |
0 | |
sein. | |
*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment