Skip to content

Instantly share code, notes, and snippets.

@grundprinzip
Created July 1, 2011 06:44
Show Gist options
  • Save grundprinzip/1057995 to your computer and use it in GitHub Desktop.
Save grundprinzip/1057995 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
class A
{
public:
void release()
{
delete this;
}
void operator delete(void* ptr, size_t s)
{
cout << "A" << endl;
}
};
class B : public A
{
public:
void operator delete(void* ptr, size_t s)
{
cout << "B" << endl;
}
};
int main()
{
B* b = new B;
b->release();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment