3-3 构造函数的调用(高级)

来源:互联网 发布:可靠性软件招标2016 编辑:程序博客网 时间:2024/06/06 03:56
#include<iostream>
using namespace std;
int x,y;
class Point
{
public:
    Point()
    {
        cout<<"constructing an object of A"<<endl;
    }
    ~Point()
    {
        cout<<"Destructing an object of A"<<endl;
    }
};
int main()
{
    cout<<"----begin main---"<<endl;
    class Point t1;
    class Point *t2=new Point;
    delete t2;
    cout<<"*******"<<endl;
    Point t3;
    Point t4;
    cout<<"----end main---"<<endl;
    return 0;
}
0 0
原创粉丝点击