#include <iostream>
usingnamespace std;
class Passport
{
private:
string PassportNumber;
public:
Passport(string pnum):PassportNumber(pnum)
{
cout<<"The Passport number is:"<<PassportNumber<<endl;
}
};
class ID:public Passport
{
private:
string IDnumber;
public:
ID(string pnum,string IDnum):Passport(pnum),IDnumber(IDnum)
{
cout<<"The ID number is:"<<IDnumber;
}
};
class Person:public ID
{
private:
string Name;
public:
Person(string IDnum,string name):ID(IDnum),Name(name)
{
cout<<"Person's name is:"<<Name<<endl;
}
};
int main()
{
Person john("50","25","John");
return 0;
}
It works fine up until I created the last class named Person. I can't manage to find out how to connect it with the Passport class. The error that pops out is in line 31 specifically and stating: "no matching function for call to ID::ID(std::string&). I also tried doing 3 string parameters and connecting the first with Passport class but doesn't work also. Maybe there is another way but I don't know how and obviously what I'm trying to do is output all of the needed strings via one derived class.