[求助]关于构造函数的问题?
#include<iostream>using namespace std;
class StudentID{
int value;
public:
StudentID(int id=0){
value=id;
cout<<"Assigning student id "<<vallue<<"\n";
}
};
class Student {
string name;
StudentID id;
public:
Student(string n="noName", int ssID=0){
cout<<"Constructing student "+n+"\n";
name=n;
StudentID id(ssID);
}
};
int main()
{Student s("Randy",58);
}
为什么StudentID构造函数却没有输出58?而是默认的0