previous | start | next

## Automatic Memory Management

- Here is a valid copy constructor for the `Department` class.

  >     Department::Department(const Department& b)
  >     {
  >        name = b.name;
  >        if (b.receptionist == NULL)
  >           receptionist = NULL;
  >        else
  >           receptionist = new Employee(b.receptionist->get_name(),
  >              b.receptionist->get_salary());
  >     }

- The parameter must be `const` reference because pass by value invokes the copy constructor!

previous | start | next