Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Question Consider the following class declaration: class PersonType { public: PersonType(); PersonType(string n, int id, string bd); private:

Question

Consider the following class declaration:

class PersonType

{

public:

 PersonType();

 PersonType(string n, int id, string bd);

private:

 string name;

 int ID;

 string birthday;

};

Explain what is wrong with the following code fragment and write code to correct it:

int main()

{

 PersonType family[20],

newBaby("Anny Dube", 20180912, "2 Sept");

//Assume family has been initialised

 for (int i = 0; i < 20; i++)

 if (family.birthday[5] == newBaby.birthday)

cout << family.name[5] << " share a birthday with "

<<newBaby.name;

 return 0;

}

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question