正在加载图片...
∥例813静态数据成员的定义和使用 #include<iostream> #include<string> using namespace std class student ipublic Student(char* pName="no name") -Studento void PrintcO i cout<< The number of student is"<<count<<endl private static int count;∥若写成 count=0;则非法 char name [20]4 //例8.13 静态数据成员的定义和使用 #include<iostream> #include<string> using namespace std; class Student {public: Student(char* pName=“no name”); ~Student(); void PrintC() { cout<<“The number of student is”<<count<<endl; } private: static int count; //若写成count=0;则非法 char name[20]; };
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有