33,311
社区成员
发帖
与我相关
我的任务
分享
class A
{
public:
void destory()
{
printf("A::destroy() this = 0x%08x, type = %s\n", (void*) this, typeid(*this).name());
delete this;
}
//int a;
// uncomment below to make the class and its subclass to be polymorphic
// virtual void vfunc()
// {
// }
};
class B : public A
{
//int b;
};
void test_03()
{
B* b = new B;
printf("b = 0x%08x, type = %s\n", (void*) b, typeid(*b).name());
b->destory();
}