/*************************************************************************** *** FILE: copy_constr.cpp *** DATE: Jan 18, 2004 *** AUTHOR: Daniel Dementiev *** GOAL: This program illustrates an initialization of one object using *** another object of the same type if ther is the copy constructor. ***************************************************************************/ #include #include using namespace std; class TString { public: TString(); TString(char *s); TString(const TString &s); void Print(); void Set(char *s); private: char *str; int size; int length; }; TString::TString() { str = new char[32]; size = 32; length = 0; str[0] = 0; } TString::TString(char *s) { length = strlen(s); size = length + 1; str = new char[size]; strcpy(str, s); } TString::TString(const TString &s) { size = s.size; length = s.length; str = new char[size]; strcpy(str, s.str); } void TString::Print() { cout<