无名对象的作用
2015-11-07 18:40
211 查看
#include<iostream> #include<stdlib.h> using namespace std; class Test { int m_data; public: Test(int i=0):m_data(i) { cout<<"Test()"<<m_data<<endl; } ~Test(){ cout<<"~Test()"<<m_data<<endl; } }; int main(int argc,char**argv) { /* Test(); cout<<"main()....."<<endl; Test *pTest=new Test(10);//application 1 堆对象传参 delete pTest; pTest=NULL; */ Test t=Test(10); //application 2 Test t1=(Test)100; //application 2 Test t2=10;//application 2 类型转换(优化) Test t3(10);//t2,t3构建是等价 return 0; }
相关文章推荐
- spring 方法拦截器 MethodInterceptor接口
- 基于 Objective-C 的中级通讯录代码
- 删掉MainStoryBoard
- 使用Fetch API和ES6生成器构建异步API
- PHP文件下载
- appium清空EditText
- Visual Studio For Unity安装之后打开Unity工程在Import Package里找不到的解决办法
- hive优化
- leetcode(136)_Single Number
- github fork项目
- java UDP实现局域网广播
- Handler机制的原理
- 接口与继承——方法覆盖
- 前端持续关注(2)-资料
- win7(64bit)利用anaconda进行theano 0.7.0的安装(anaconda+theano+cuda+vs2010编程环境搭建)
- 编写javascript的方法实现的一些功能。
- oracle高性能的SQL语句的写法
- 从CVPR 2014看计算机视觉领域的最新热点
- 计算机视觉、机器学习相关领域论文和源代码大集合
- ny123 士兵杀敌(四)【线段树&&树状数组】