SDUT-2671 3-2 构造函数的调用
来源:互联网 发布:手机淘宝怎样发送链接 编辑:程序博客网 时间:2024/06/06 20:43
3-2 构造函数的调用
Time Limit: 1000MS Memory Limit: 65536KBSubmit StatisticProblem Description
通过本题目的练习可以掌握构造函数和析构函数的调用;
创建类A;类中仅包含构造函数和析构函数,按照程序的输出写出类的定义和主函数main中的代码。
Input
无
Output
输出数据有4行,分别代表对构造函数和析构函数的调用;本练习要求所编写程序的输出必须与示例相同。
Example Input
无
Example Output
Constructing an object of AConstructing an object of ADestructing an object of ADestructing an object of A
Hint
Author
黄晶晶#include <bits/stdc++.h>using namespace std;class point{public: point(); ~point();};point::point(){ cout<<"Constructing an object of A"<<endl;}point::~point(){ cout<<"Destructing an object of A"<<endl;}int main(){ point *a; a=new point; delete a; point b; return 0;}
通过本题目的练习可以掌握构造函数和析构函数的调用;
创建类A;类中仅包含构造函数和析构函数,按照程序的输出写出类的定义和主函数main中的代码。
无
输出数据有4行,分别代表对构造函数和析构函数的调用;本练习要求所编写程序的输出必须与示例相同。
无
Constructing an object of AConstructing an object of ADestructing an object of ADestructing an object of A
#include <bits/stdc++.h>using namespace std;class point{public: point(); ~point();};point::point(){ cout<<"Constructing an object of A"<<endl;}point::~point(){ cout<<"Destructing an object of A"<<endl;}int main(){ point *a; a=new point; delete a; point b; return 0;}
阅读全文
0 0
- sdut 3-2 构造函数的调用
- 3-2 构造函数的调用-SDUT
- SDUT-2671 3-2 构造函数的调用
- sdut 3-3 构造函数的调用(高级)
- 3-3 构造函数的调用(高级)--SDUT
- SDUT-2672 3-3 构造函数的调用(高级)
- [2671]3-2 构造函数的调用
- 2671 3-2 构造函数的调用
- [2670]3-1 Point类的构造函数 SDUT
- sdut 3-1 Point类的构造函数
- sdut 5-3 多级派生类的构造函数
- sdut 5-3 多级派生类的构造函数
- 3-1 Point类的构造函数-SDUT
- SDUT-2670 3-1 Point类的构造函数
- SDUT-2713-->5-3 多级派生类的构造函数
- SDUT 2712 5-2 派生类的构造函数
- sdut 5-2 派生类的构造函数
- sdut 5-2 派生类的构造函数
- 【Python】【yield】生成器的使用
- 【算法——Python实现】并查集及优化
- ubuntu16.04设置静态IP
- Android 7.0 行为变更 通过FileProvider在应用间共享文件吧
- 指针和引用的区别
- SDUT-2671 3-2 构造函数的调用
- java面向对象
- 基于数组的列表实现
- Spring 松耦合实例
- G
- Linux学习掌握(三):CentOS中安装(卸载)Mysql以及数据库的导入导出
- Scikit-learn使用总结
- Hrbust 2302 Another Tree【思维+Dfs】
- 一个理解装饰器很好的例子