#include <stdio.h>
#include "base_util.h"函數
class A
{
public:
A()
{
printf("A();\n");
}
~A()
{
printf("~A();\n");
}
};io
void *create_obj()
{
A *a = new A();
return a;
}
void free_obj(void *p)
{
if (p)
{
delete p ; //這個不會調用析造函數
//delete (A*)p; //這個會調用析造函數
}
}class
int main(int argc, char *argv[])
{
void *p = create_obj();
free_obj(p);
return 0;
}
gc