Question: Please answer question BCD, We are rate a good and complete answer please don't comment thank you 2. The code block (which runs without break

Please answer question BCD,
We are rate a good and complete answer
Please answer question BCD,We are rate a good and complete answer please
don't comment thank you 2. The code block (which runs without break
onto the next page) gives a C++ implementation of a class hierarchy
please don't comment thank you

2. The code block (which runs without break onto the next page) gives a C++ implementation of a class hierarchy for encoding information about people present at a university. (b) There are four errors in the code provided that will prevent it from compiling. Locate each error by giving the line number, and describe the nature of each error. [4 marks] (c) Assume that the aforementioned errors have been corrected. Write the output that the running code will produce. Where appropriate, describe why the code produces the output you have indicated. [4 marks) (d) Describe how you would implement a class called AttendanceList which could be used to store an ordered list of multiple university attendees (students, professors, etc.). Describe how you would use polymorphism and why, including the possible drawbacks of your choice 14 marks! 1 #include 2 #include 3 using namespace std; 4 5 class Person 6 { 7 public: 8 Person () {}; 9 10 virtual Person () {}; 11 12 void setName(const std::string & name) { 13 this->name = name; 14 } 15 void setAge(int age) { 16 this->age = age; 17 } 18 std::string getName() const { 19 return name; 20 } 21 void getAge() const { 22 // Ensure you can't be aged less than zero 23 if(age setName("Sara"): 72 p->setAge (32): 73 74 Person rp = new RetiredProfessor(): 75 rp->setName("William"): 76 77 Person X=&s; 78 79 coutgetName()getAge()getName()agegetName()getAge ()about()about() about()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!