Section 14.13 Check Point Questions4 questions 

14.13.1
In what situation should you overload the copy constructor, the = operator, and the destructor?
14.13.2
Show the output of the following code:
#include <iostream>
#include "CourseWithCustomCopyConstructor.h" // See Listing 11.19
using namespace std;

void printStudent(const Course& course)
{
  for (int i = 0; i < course.getNumberOfStudents(); i++)
  {
    cout << course.getStudents()[i] << " ";
  }
  cout << endl;
}

int main()
{
  Course course1("Java Programming", 10);
  course1.addStudent("John");
  Course course2("C++ Programming", 30);
  Course course3("Python Programming", 40);
  course3 = course2 = course1 = course1;

  course1.addStudent("Peter Pan"); // Add a student to course1
  course3.addStudent("Lisa Ma"); // Add a student to course2

  printStudent(course1);
  printStudent(course2);
  printStudent(course3);

  return 0;
}
14.13.3
If copying to itself is not checked in line 63 in the opearator= function in Listing 14.12, what will be the output from the preceding question?
14.13.4
If the old array is not deleted in line 69 in the opearator= function in Listing 14.12, what will be the output from the preceding question? What will happen to the old array?