| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1006 人关注过本帖
标题:怎么调用析构函数??
取消只看楼主 加入收藏
caiqiufu
Rank: 1
等 级:新手上路
帖 子:93
专家分:0
注 册:2006-12-14
收藏
 问题点数:0 回复次数:0 
怎么调用析构函数??
#include<iostream.h>
class A
{
public:
A(int i=0)
{m=i;cout<<"Constructor called."<<m<<endl;}
void Print() const
{cout<<m<<endl;}
~A()
{cout<<"Destructor called."<<m<<endl;}
private:
int m;
};
void main()
{
const int N=5;
A my;
my=N;//该处为什么调用了一次析构函数??
my.Print();
}
搜索更多相关主题的帖子: 函数 int cout endl void 
2006-12-21 22:55
快速回复:怎么调用析构函数??
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011634 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved