f:\arm\program\point\point\point.cpp(24) : error C2512: 'Time' : no appropriate default constructor

#include <iostream>
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

查资料说是析构函数出错,所有在析构函数上改了又改,最后发现时因为在初始化对象时没有给析构函数实参



你可能感兴趣的:(f:\arm\program\point\point\point.cpp(24) : error C2512: 'Time' : no appropriate default constructor)