// @topic T070m11d07x30 class DString -- copy constructor, destructor, assignment op // @brief main driver code #include <iostream> #include <cstdlib> #include <string> #include "DString.h" int main() { DString str{ "ABC" }; std::cout << "string contains [" << str << "]" << " length: " << str.length() << " capacity: " << str.capacity() << "\n" ; // avoid shallow copy -- copy ctr takes care of that: DString str_copy = str; // avoid shallow assignment by overloaded = op takes care of that: str_copy = str; str = str = str; // self-assignment and chained assignment... while ( std::cin ) { std::cin >> str; std::cout << "you entered [" << str << "]" << " length: " << str.length() << " capacity: " << str.capacity() << "\n" ; } system("pause"); return 0; } int std_main() { std::string str; while( std::cin ) { std::cin >> str; std::cout << "you entered " << str << "\n"; } return 0; }