Skip to content

Instantly share code, notes, and snippets.

@ceeji
Created June 2, 2011 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ceeji/1004297 to your computer and use it in GitHub Desktop.
Save ceeji/1004297 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <cstdlib>
using namespace std;
class A
{
public:
A()
{
cout << "Init A..." << endl;
}
virtual ~A()
{
cout << "Dispose A..." << endl;
}
};
class B : public A
{
public:
B()
{
cout << "Init B..." << endl;
}
virtual ~B()
{
cout << "Dispose B..." << endl;
}
};
void func()
{
A* a = new B();
delete a;
}
int main()
{
func();
system("pause");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment