#include<iostream>
using namespace std;
class A
{
public:
A()
{
}
};
class B:public A
{
public:
B()
{
}
};
int main()
{
B* pB=new B();
A* pA=pB;
delete pA;
return 0;
}
请问这个delete能正确删除B对象吗,说明一下,谢谢
class A
{
public:
A(){a=0;}
int a;
};
class B:public A
{
public:
B(){b=0;}
int b;
};
若改为这样,是不是delete就不能正常删除B对象了?
qq_遁去的一_1