65,183
社区成员




#include <iostream>
using namespace std;
class B
{
public :
int * a;
B(){a=new int;}
~B(){delete a;}
};
int main ()
{
B * b;
char * buffer= new char[1024*1024];
b=(B*)buffer;
delete b;
return 0;
}
#include <iostream>
using namespace std;
class B
{
public:
B(){p=new char[9999];}
~B(){cout<<"+_+"<<endl; delete[] p;};
void operator delete(void *){cout<<"+_+ +_+ +_+"<<endl;};
private: char *p;
};
int main()
{
char str[100];
char * buffer= new char[1024];
B * b=(B*)buffer;
delete b;
return 0;
}
#include <stdio.h>
struct B
{
int a;
};
int main ()
{
B * b;//(1)
char * buffer= new char[1024*1024]; //(2)
b=(B*)buffer; //(3)
delete buffer;
return 0;
}