// cdt.cc   Experiments with constructors and destructors
//        When are they called?   P. Conrad for CISC220 06J

#include "cdt.h"

#include <iostream>
using std::cerr;
using std::endl;


Cdt_C::Cdt_C(int theX, const char * const theLabel, int theHour, int theMin)
 : CD_C(theX,theLabel), t(theHour,theMin)
{
#ifdef DEBUG_CDT
  cerr << "Entering (1) Cdt_C(int theX, const char * const theLabel, int theHour, int theMin); " << endl;
#endif


#ifdef DEBUG_CDT
  cerr << "Exiting (1)  " << endl;
#endif
}

Cdt_C::Cdt_C() 
{
#ifdef DEBUG_CDT
  cerr << "Entering (2) Cdt_C(); " << endl;
#endif

#ifdef DEBUG_CDT
  cerr << "Exiting (2) Cdt_C(); " << endl;
#endif
}

  

Cdt_C::Cdt_C(const Cdt_C & orig) :
  CD_C(orig)
{
#ifdef DEBUG_CDT
  cerr << "Entering (3) Cdt_C(const Cdt_C & orig); (copy constructor) " << endl;
#endif

#ifdef DEBUG_CDT
  cerr << "Exiting (3) Cdt_C(const Cdt_C & orig); (copy constructor); " << endl;
#endif

}
Cdt_C & Cdt_C::operator = (const Cdt_C & right)
{

#ifdef DEBUG_CDT
  cerr << "Entering (4) operator = (const Cdt_C & right)" << endl;
#endif

  t = right.t;

#ifdef DEBUG_CDT
  cerr << "Exiting (4) operator = (const Cdt_C & right)" << endl;
#endif

  return (*this);

}

Cdt_C::~Cdt_C()
{
#ifdef DEBUG_CDT
  cerr << "Entering (5) ~Cdt_C()" << endl;
  cerr << "Invoking the destructor for object with parent object " << CD_C::print(*this) << endl;
#endif


#ifdef DEBUG_CDT
  cerr << "Exiting (5) ~Cdt_C()" << endl;
#endif

}



ostream & operator << (ostream & left, const Cdt_C & right)
{
#ifdef DEBUG_CDT
  cerr << "Entering (6) << (ostream & left, const Cdt_C & right) " << endl;
#endif


  right.print(left);
  return (left);

#ifdef DEBUG_CDT
  cerr << "Exiting (6) << (ostream & left, const Cdt_C & right) " << endl;
#endif

}
