当前位置:
首页 >
静态成员的使用
发布时间:2025/4/16
23
豆豆
<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>
总结
- 上一篇: directshow+opencv显示u
- 下一篇: 数字转换成字符串进行连接