Question: (Optional) Enhance your program to gain experience with backlink maintenance and reference counting as follows: 1. Implement a DropCourse () interface for student. That is,

(Optional) Enhance your program to gain experience with backlink maintenance and reference counting as follows:

1. Implement a DropCourse () interface for student. That is, create a Student: : DropCourse (Course *) method in Student. Here, find the course the student wishes to drop in their course list, but before removing the Course, call a method on that course to remove the aforementioned student (that is, this) from the Course. 

2. Now, fully implement proper destructors. When a course is destructed, have the course destructor first tell each remaining associated student to remove their link to that course.

Likewise, when a student is destructed, loop through the Student's course list to ask those courses to remove the aforementioned student (that is, this) from their student list. You may find reference counting in each class (that is, by checking numStudents or numCourses) helpful to see whether these tasks must be engaged.

Step by Step Solution

3.44 Rating (163 Votes )

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 A Practical In Depth Guide C++ Questions!