class B
{
string s;
~B(){}
};
class D : public B
{
string t;
};
int main()
{
B *bp = new D;
delete bp;
return 0;
}
这样汇报错的 但是 把那个虚析构函数去掉 就没错 为什么
...全文
295打赏收藏
大哥大姐们 来看看
谁能告诉我 是为什么 #include using namespace std; class B { string s; ~B(){} }; class D : public B { string t; }; int main() { B *bp = new D; delete bp; return 0; } 这样汇报错的 但是 把那个虚析构函数去掉 就没错 为什么