运算符重载
来源:互联网 发布:ckplayer 源码 编辑:程序博客网 时间:2024/05/24 06:43
//创建num类:
#include <iostream>
using namespace std;
class num
{
public:
num(){n=1;}
~num(){}
int get()const{return n;}
void set(int x){n=x;}
private:
int n;
};
int main()
{
num i;
cout<<"i:"<<i.get()<<endl;
//++i;
return 0;
}
#include <iostream>
using namespace std;
class num
{
public:
num(){n=1;}
~num(){}
int get()const{return n;}
void set(int x){n=x;}
private:
int n;
};
int main()
{
num i;
cout<<"i:"<<i.get()<<endl;
//++i;
return 0;
}
#include <iostream>
using namespace std;
class num
{
public:
num(){n=1;}
~num(){}
int get()const{return n;}
void set(int x){n=x;}
void add(){++n;}
private:
int n;
};
int main()
{
num i;
cout<<"i:"<<i.get()<<endl;
i.add();
cout<<"i:"<<i.get()<<endl;
return 0;
}
- 运算符重载 [++,--,+,<<; &&,||(不可重载)]
- 重载之运算符重载
- 重载赋值运算符
- C++运算符重载
- 运算符重载
- 运算符重载总结
- 运算符重载例子
- 运算符重载
- 运算符重载
- 基础:运算符重载
- 运算符重载
- 运算符重载
- 重载赋值运算符
- C#运算符重载
- C++-运算符重载
- 重载赋值运算符
- 运算符重载
- 有关运算符重载
- 阿里巴巴集团去IOE运动的思考与总结
- VS2010完全卸载
- JIRA BUG跟踪系统
- IOS开发中网络状态的判断和时时更新
- myeclipse 文件快速定位怎么设置、文件定位取消
- 运算符重载
- mysql之frederated存储引擎
- 多选列表Select之双击删除与添加Demo
- register_chrdev() register_chrdev_region() alloc_chrdev_region的区别?
- 十道海量数据处理面试题与十个方法大总结
- Android如何防止apk程序被反编译
- iOS ARC 和 非ARC 互转
- Android 中文件类型与MIME的匹配表
- Eclipse导入项目,java文件中文乱码的解决方案