<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>
静态成员的使用
最新推荐文章于 2023-01-09 22:32:00 发布