阅读程序
来源:互联网 发布:新浪宏观经济数据 编辑:程序博客网 时间:2024/04/28 06:23
#include <iostream>using namespace std;class base{private: int m;public: base() {}; base(int m){this->m=m;} int get(){return m;} void set(int m){this->m=m;}};//base_endint main(){ base *ptr; ptr=new base[2]; ptr->set(30); ptr=ptr+1; ptr->set(50); base a[2]= {1,9}; cout<<a[0].get()<<","<<a[1].get()<<endl; /// 1 9 cout<<ptr->get()<<",";/// 50 ptr=ptr-1; cout<<ptr->get()<<endl;/// 30 delete[] ptr; return 0;}
输出结果:
0 0
- 阅读程序
- 阅读 程序
- 阅读程序
- 阅读程序
- 阅读程序
- 阅读程序
- 阅读程序
- 阅读程序
- 程序阅读
- 阅读程序
- 阅读程序
- 阅读程序
- 阅读程序
- 阅读程序
- 阅读程序
- 阅读程序
- 阅读程序
- 阅读程序
- 时序数据库简介
- 大一第二学期第5周【程序阅读(1)】
- 第五周阅读程序1:用指针建立对象
- POJ 2435(打印最优解方案)
- Mycat开源宣言
- 阅读程序
- 第五周 阅读程序(2)
- 题解 NYOJ248 BUYING FEED
- RTAI installation for Ubuntu 14.04
- 大一第二学期第5周【程序阅读(2)】
- git branch -D 大写的D 删除分支
- 第5周项目1-体验常成员函数
- 体验常成员函数-平面坐标点类
- 海尔系列报道之一:海尔“小微”怎么玩