- 參照「名稱」不明確
- 參照「年齡」是模糊
- 請求構件「INPUT1」不明確
- 沒有匹配函數調用' ashish3 :: inputage()」
這裏是我的代碼:
#include <iostream>
#include <string>
using namespace std;
class ashish
{
protected:
string name;
public:
void input1(string name1)
{
cin >> name1;
name = name1;
}
int age;
};
class ashish2 : public ashish
{
public:
void inputage(int age1)
{
cin >> age1;
age = age1;
}
void display()
{
cout << name;
}
};
class ashish3 : public ashish, public ashish2
{
public:
void showme()
{
cout << "the name is" << name << endl << "the age is " << age << endl;
}
};
int main()
{
ashish3 rocker;
rocker.input1();
rocker.inputage();
rocker.display();
rocker.showme();
return 0;
}
您是否試過Hello World? –
此代碼中的所有內容均爲錯誤 – DimChtz
如果您花時間逐個處理這些錯誤消息,則實際解釋錯誤消息。 – Peter