// instructor.cc   Example derived class
// P. Conrad for CISC220, 06J

#include "instructor.h"



Instructor_C::Instructor_C(const Instructor_C & orig) :
  Person_C(orig)
{
  allocateAndCopy(dept,orig.dept);
}

Instructor_C & Instructor_C::operator =(const Instructor_C & right)
{
  // check for self-assignment

  if (&right == this)
    return (*this);

  // fill this in later! @@@@@

  
  Person_C::operator=(right);
  
  delete [] dept;
  allocateAndCopy(dept, right.dept);
  
  
  // return reference to self to enable chaining (e.g. a = b = c;)

  return (*this);

}

Instructor_C::~Instructor_C()
{
  // What to do about base class destructor... @@@ ???
  // See : http://burks.bton.ac.uk/burks/language/cpp/cppfaq/dtors.htm#[11.12]

  delete [] dept;
  dept = NULL;
}


void Instructor_C::print(std::ostream & out) const
{
  Person_C::print(); out << " " << dept;
}

// the following illustrates that the parameters don't have to be
// right and left---here we use "where and what" instead.

std::ostream & operator << (std::ostream & where, 
			    const Instructor_C & what)
{
  what.print(where);
  return (where);
}




