Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2538552
  • 博文数量: 308
  • 博客积分: 5547
  • 博客等级: 大校
  • 技术积分: 3782
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-24 09:47
个人简介

hello world.

文章分类

全部博文(308)

分类: C/C++

2010-11-25 15:13:43

代码代码:
 

#include <iostream>
using namespace std;

class A
{
    public:
    A(){ cout << "construction A" << endl;}
    ~A(){cout << "destructing A" << endl;}
};

class B: public A
{
    public:
    B(){ cout << "construction B" << endl;}
    ~B(){cout << "destructing B" << endl;}
};

class C: public B
{
    public:
    C(){ cout << "construction C" << endl;}
    ~C(){cout << "destructing C" << endl;}
};

int main()
{
    C c1;
    c1.~C();
    system("pause");
    return 0;
}


运行结果:
construction A
construction B
construction C
destructing C
destructing B
destructing A
阅读(2387) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~