Exercise #7

Consider the following header file, named Stringy.h: And, consider the following C++ file that contains main, named test_stringy.cc: Your job is to implement Stringy.cc, the C++ source file that goes along with Stringy.h. Once you have implemented it, you can compile and run test_string.cc as follows:

bash$ g++ -Wall -std=gnu++0x -g -o test_stringy Stringy.cc test_stringy.cc
bash$ ./test_stringy
Constructor(Test string!)
----- 1. string: Test string!
Copy constructor(Test string!)
----- 2. upper string: TEST STRING!
Destructor(TEST STRING!)
Copy constructor(Test string!)
Copy constructor(TEST STRING!)
----- 3. upper lower string: test string!
Destructor(test string!)
Destructor(TEST STRING!)
Constructor()
Copy constructor(Test string!)
Move assign(test string!)
Destructor(null)
----- 4. copy assigned copy: test string!
Copy constructor(test string!)
----- 5. lower temporary: test string!
Destructor(test string!)
Copy assign(test string!)
Destructor(test string!)
Destructor(Test string!)
bash$
Notes: