Questions
- Add an additional
Student
constructor to theUniversity
/Student
example in this chapter to accept theUniversity
constructor argument by reference, rather than by pointer. For example, in addition to the constructor with the signatureStudent::Student(const string &fn, const string &ln, char mi, const string &t, float avg, const string &course, const string &id, University *univ);
, overload this function with a similar one, but withUniversity &univ
as the last parameter. How does this change the implicit call to this constructor?
Hint: within your overloaded constructor, you will now need to take the address-of (&
) the University
reference parameter to set the association (which is stored as a pointer). You may need to switch to object notation (.
) to set the backlink (if you use parameter univ
, versus data member this->univ
).
- Write a C++ program to implement a many-to-many association between objects of type
Course
and...