using namespace std;
class Time
{
private:
int num;
int score;
public:
Time(int,int);
void ShowScore();
};
void Time::ShowScore()
{
cout << num << ' ' <<score << endl;
}
Time::Time(int h,int m)
{
num = h;
score = m;
}
int main(void)
{
Time student;
student.ShowScore();
return 0;
}
運行時出現error C2512: 'Time' : no appropriate default constructor available
查資料說是析構函數出錯,所有在析構函數上改了又改,最後發現時因爲在初始化對象時沒有給析構函數實參