在运行时会发生什么? [英] What happens exactly during run time?

查看:70
本文介绍了在运行时会发生什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

班级{

public:

int x;

just(){x = 1234; }

just(int i){x = i;}

~just(){cout<< "我们在这里 ;}

};


int main()

{

只是j1;

只是* jptr = new just(5432);


delete(jptr);

delete(& j1);


cout<< Test Out \\\
;


返回0;

}


执行析构函数后,为J1程序调用Visual中止中止br />
Studio 6

class just{
public :
int x;
just(){ x=1234; }
just(int i){ x = i;}
~just(){ cout << " Here We Are\n" ;}
};

int main()
{
just j1;
just *jptr =new just(5432);

delete( jptr);
delete( &j1);

cout << "Test Out \n" ;

return 0;
}

After executing destructor for J1 program calls for an abort in Visual
Studio 6

推荐答案

Pranav写道:
Pranav wrote:

class只需{

public:

int x;

just(){x = 1234; }

just(int i){x = i;}

~just(){cout<< "我们在这里 ;}

};


int main()

{

只是j1;

只是* jptr = new just(5432);


delete(jptr);

delete(& j1);


cout<< Test Out \\\
;


返回0;

}


执行析构函数后,为J1程序调用Visual中止中止br />
Studio 6
class just{
public :
int x;
just(){ x=1234; }
just(int i){ x = i;}
~just(){ cout << " Here We Are\n" ;}
};

int main()
{
just j1;
just *jptr =new just(5432);

delete( jptr);
delete( &j1);

cout << "Test Out \n" ;

return 0;
}

After executing destructor for J1 program calls for an abort in Visual
Studio 6



那么你期待什么? j1没有动态分配。


-

Ian Collins。

Well what did you expect? j1 wasn''t dynamically allocated.

--
Ian Collins.


Pranav ha scritto:
Pranav ha scritto:

delete(& j1);
delete( &j1);



以前的新品在哪里?

Where is its previous new?





Ya我知道那件事,但当我打电话''删除(& j1)''之后调用

''j1''的析构函数后,会出现一个窗口显示''Abort / Ignore /

重试''。为什么会出现这种情况?任何人都可以解释运行期间发生了什么吗?



Ya I know that thing, But When I call ''delete(&j1)'' the destructor for
''j1'' is called after this there is window appears saying ''Abort/Ignore/
Retry''. Why exactly this behaviour occurs? Can any one explain what
happens during runtime?


这篇关于在运行时会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆