【CPP】static思考-2
来源:互联网 发布:黑手党3和dlc 知乎 编辑:程序博客网 时间:2024/05/20 00:15
//t1.h//static int count;int count;inline int Init(){count = 0;return 0;}inline int AddValue(int v){count += v;return count;}
//t2.cpp#include<iostream>#include"t1.h"using namespace std;int PrintInT2(){cout << "PrintInT2" << endl;for(int i=0;i<10;++i) cout << AddValue(1) << " ";cout << endl;return 0;}
//t1.cpp#include<iostream>#include"t1.h"extern int PrintInT2();using namespace std;int PrintInT1(){cout << "PrintInT1" << endl;for(int i=0;i<10;++i) cout << AddValue(1) << " ";cout << endl;return 0;}int main(){Init();PrintInT1();PrintInT2();return 0;}
//编译错误 : multiple definition of `count'
0 0
- 【CPP】static思考-2
- [CPP]static思考-1
- [CPP]static思考-3
- [CPP]static思考-4
- static.cpp
- CPP-static members
- 1. static 关键字.算法cpp
- 【C/C++】static 的思考
- 关于static 的一点思考
- 从Main函数引发的static思考
- 从Main函数引发的static思考
- 关于java中Static的一些思考
- 关于Java中static的一点思考
- Java中static与final的思考
- Java Static关键字引发的思考
- C语言中static关键字的思考
- 【Java】java static标识符引发的思考
- 有static变量的namespace被多个cpp包含
- Sql Server中的表组织和索引组织(聚集索引结构,非聚集索引结构,堆结构)
- .Net 调用存储过程取到return的返回值
- IOS应用开发09——为自定义UITableViewCell的部分区域添加手势
- 尚学堂在线聊天雏形Chat学习笔记
- InputStream中read的使用理解
- 【CPP】static思考-2
- 数据结构(线性表)-顺序表
- Spark集群配置
- 【UVA】12169-Disgruntled Judge(暴力or欧几里得)
- UVA167
- UISegmentedControl-IOS开发
- hdu4417(主席树)
- POJ 2528 Mayor's posters (线段树,扫描线)
- Nested Segments