![]() |
#2
柳儿2006-01-18 11:33
|
class Student
{
public:
Student(char*pName="no name",int ssID=0):id(ssID){} //为什么不能加{},如果id是常量或者引用为什么可以加{}
{
cout<<"Constructing student"<<pName<<endl;
strncpy(name,pName,sizeof(name));
name[sizeof(name)-1]='\0';
}
protected:
char name[20];
StudentID id;
};