静态成员的使用
2015-09-22 22:00
246 查看
<span style="font-size:18px;">#include<iostream> using namespace std; class book { private: static int couter; public: book(char* title) { cout << "售出的书" << title << endl; couter++; } static int getcouter() { return couter; } }; int book::couter = 0; int main() { typedef char strings[100]; strings title[] = { "实验书", "编程数", "视频书" }; for (int i = 0; i < 3; i++) { new book(title[i]); } cout << "总数" << book::getcouter << "图书" << endl; system("pause"); return 0; }</span>
相关文章推荐
- Android_开发人员经常使用的颜色
- 基础DFS-Lake Counting
- 基础DFS-Lake Counting
- 图像处理中的数学原理详解(Part2)
- ocp-v13-480
- CYC-多线程 售票问题
- 用C语言编写的简单的猜数字游戏
- spark sql cache
- spark sql cache
- spark sql cache
- ubuntu中孤儿进程的父进程pid并不是1??
- spark sql cache
- hdu1573 X问题(中国剩余定理)
- 数独游戏的设计与实现之第一篇——理解数独过程
- hdu3078 伪LCA……
- mysql修改root密码的方法
- 非类型模板参数
- FSWD_2_JavaScript
- velocity基本语法
- python 定时器