我碰到下面的錯誤,我想不通爲什麼:找不到匹配
Could not find a match for 'PEmployee::PEmployee(char *, double)' in function main()
這裏是我的代碼:
class PEmployee
{
public:
PEmployee();
PEmployee(string employee_name, double initial_salary);
void set_salary(double new_salary);
double get_salary() const;
string get_name() const;
private:
Person person_data;
double salary;
};
int main()
{
PEmployee f("Patrick", 1000.00);
cout << f.get_name() << " earns a salary of ";
<< f.get_salary() << endl;
return 0;
}
有人能告訴我爲什麼我得到這個錯誤?
謝謝。
是否定義了'string'? – chris
備註與手邊的問題無關:''在'「之後''應該沒有分號';'因爲表達式繼續到下一行,所以薪水爲'''。 – jogojapan