All pastes #1650239 Raw Edit

Dangling Pointer

public cpp v1 · immutable
#1650239 ·published 2009-10-31 09:07 UTC
rendered paste body
#include <iostream>using namespace std;class A{public :	A(){		cout<<"A ctor called"<<endl;		}		~A(){		cout<<"A dtor called"<<endl;		}	void f(){		cout<<"f called"<<endl;	}	};class B : public A{public :	B(){		cout<<"B ctor called"<<endl;		}		~B(){		cout<<"B dtor called"<<endl;		}};int main(){	B *c;	c->f();}/* OUTPUT :rahul@kodersbox:~/Desktop$ g++ boo.cpprahul@kodersbox:~/Desktop$ ./a.outf called*/