一个奇怪的问题,请大家看一看,谢谢了

wftree wftree 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
#include <iostream.h>
class ca
{public:
ca(){cout<<endl<<"bulid a";}
~ca(){cout<<endl<<"destroy a";}
virtual ok()
{
cout<<endl<<"I still living !";
int ss=33;
}
};
ca *test()
{
ca *p=new ca;
return p;
}
void main()
{
ca *ss=test();
delete ss;
ss->ok();
}


ss为什么还是可以运行了?他指向的那一个内存不是已经放弃了吗?
...全文
评论 8
收藏 已收藏
分享
返回顶部
wftree
C语言 70,039 成员 243,237 内容