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

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;

}

"Get 15% discount on your first 3 orders with us"
Use the following coupon
FIRST15

Order Now

Hi there! Click one of our representatives below and we will get back to you as soon as possible.

Chat with us on WhatsApp