Skip to content

Instantly share code, notes, and snippets.

@benben
Created July 4, 2011 13:51
Show Gist options
  • Save benben/1063354 to your computer and use it in GitHub Desktop.
Save benben/1063354 to your computer and use it in GitHub Desktop.
#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