//tails.cpp #include"tails.h" int Tails::totalcount=0; int Tails::copycount=0; int Tails::currentcount=0; int Tails::defaultcount=0; ofstream Tails::tailsout("htout.txt"); Tails::Tails() { tailsout << "In Tails default constructor." << endl; n=rand()%100; totalcount++; currentcount++; defaultcount++; ID=totalcount; //every tail made will get //a different ID tailsout << " " << *this << endl; } Tails::~Tails() { tailsout << "In Tails destructor." << endl; currentcount--; tailsout << " " << *this << endl; } Tails::Tails(const Tails & original) { //copies the value for n, but not the ID. tailsout << "In Tails copy constructor." << endl; n=original.n; totalcount++; ID=totalcount; copycount++; currentcount++; tailsout << " Original: " << original; tailsout << "\n Copy: " << *this << endl; } const Tails & Tails::operator =(const Tails & source) { tailsout << "In Tails assignment =" << endl; n=source.n; tailsout << " Copying " << source<< "\n\tto " << *this << endl; return source; } void Tails::summary(ostream & out) { out << "TOTAL TAILS MADE: " << totalcount << endl; out << "MADE BY DEFAULT CONSTRUCTOR: " << defaultcount << endl; out << "MADE BY COPY CONSTRUCTOR: " << copycount << endl; out << "MADE BY OPERATOR=: NONE!" << endl; out << "CURRENT NUMBER OF TAILS: " << currentcount << endl; } ostream & operator<<(ostream & fout,const Tails & t) { fout << "Tails ID: " << t.ID << " Value(n): " << t.n; return fout; }