正在加载图片...
例9.3对象成员的使用 class studentID i public private: char name studentI studentid id i value=0; cout<<"calling studentID void main( <value<<endl: student s(“ Randy); private: int value. class student i public: student(char n) i name=new char strlen(n)+1); strcpy(name, n); cout<<"calling student"<<endl;对象成员的使用 class studentID { public: studentID() { value=0; cout<<“calling studentID” <<value<<endl; } private: int value; }; class student { public: student(char * n) { name=new char(strlen(n)+1); strcpy(name,n); cout<<”calling student”<<endl; } 例 9.3 private: char*name; studentID id; }; void main() { student s(“Randy”); }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有