不知道哪里错了,求大家解答编译问题

#include <iostream>
#include <string>
using namespace std;
//定义一个基类Person,Person里有5个protected类型的成员
class Person
{
public:
    Person(string , int, char, string, string);
    void display();
protected:
    //姓名 
    string name;
    //年龄 
    int age;
    //性别 
    char sex;
    //地址 
    string addr;
    //电话 
    string tel;
};
Person::Person(string nam, int a, char s, string ad, string te)
    {
        name = nam; age = a; sex = s; addr = ad; tel = te;
    }
void Person::display()
{
    cout << "name: " << name << endl;
    cout << "age: " << age << endl;
    cout << "sex: " << sex << endl;
    cout << "address: " << addr << endl;
    cout << "tel: " << tel << endl;
}
class Teacher:virtual public Person
{
public:
    Teacher(string nam, int a, char s, string ad, string te, string tit) :Person(nam, a, s, ad, te),title(tit){}
    void display1();
protected:
    string title;
};
void Teacher::display1()
{
    cout << "name: " << name << endl;
    cout << "age: " << age << endl;
    cout << "sex: " << sex << endl;
    cout << "title: " << title << endl;
    cout << "address: " << addr << endl;
    cout << "tel: " << tel << endl;
}
class Cadre:virtual public Person
{
public:
    Cadre(string nam, int a, char s, string ad, string te, string po) :Person(nam, a, s, ad, te),post(po){}
    void display2();
protected:
    string post;
};
void Cadre::display2()
{
    cout << "name: " << name << endl;
    cout << "age: " << age << endl;
    cout << "sex: " << sex << endl;
    cout << "address: " << addr << endl;
    cout << "tel: " << tel << endl;
    cout << "post: " << post << endl;
}
class Teacher_Cadre : public Teacher, public Cadre
{
public:
    Teacher_Cadre(string nam, int a, char s, string ad, string te, string tit, string po, double w) :
    Teacher(nam, a, s, ad, te, tit), Cadre(nam, a, s, ad, te, po),wages(w){}
    void show();
private:
    double wages;
};
void Teacher_Cadre::show()
{
    Teacher::display();
    cout << "post: " << Cadre::post << endl;
    cout << "wages: " << wages << endl;
};
int main()
{
    Teacher_Cadre person("YuDunhui", 18, 'M', "Wuhan", 88664102, "professor", "assitant", 20000);
    person.show();
    return 0;
}

有错误信息吗?把编译报错的信息发出来看看。

你的错误在于定义电话类型是String字符串类型,但是实际你给他赋值却是整数类型,所以在创建类的时候报错了,另外你的这个 Id returned 1可能是你没有关闭运行窗口,就进行修改后再编译,其他可能错误可以参考这篇文章https://blog.csdn.net/arieszsw/article/details/106953864

如果对你有帮助,记得采纳一下哦,谢谢

您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~

如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~

ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632