cpp\operator_delete_destructor_call.cpp

This commit is contained in:
2014-05-31 23:04:41 +04:00
parent 7cdff553c8
commit e6a4592ea3
5 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
// testConstructorCall.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
class a
{
public:
a()
{
printf( "a\n" );
}
~a()
{
printf( "~a\n" );
}
int f()
{
return 0;
}
void operator delete ( void* p )
{
printf( "operator delete()\n" );
}
};
int _tmain(int argc, _TCHAR* argv[])
{
/*
a o;
// o.a( 0 );
o.~a();
o.f();
reinterpret_cast<a*>(0)->a::a();
*/
a* p1 = new a();
delete p1;
a* p2 = new a();
a::operator delete( p2 );
return 0;
}