/////////////////////////////////////////////////////////////////////// // useStr.cpp - how do I use a "user defined type"? // /////////////////////////////////////////////////////////////////////// // step #1 - include header file for user defined type, str.h // // step #2 - make implementation file part of your project, str.cpp // // step #3 - use the member functions of the user defined class to // // help with the processing in your implementation file. // /////////////////////////////////////////////////////////////////////// #include "str.h" #include using namespace std; void main() { cout << "\n Testing User Defined Str Class " << "\n ================================\n\n"; str s = "this is a string"; // using promotion ctor cout << " " << s << endl; // using operator<<(...) s += " with an appended string"; // using operator+=(...) cout << " " << s << endl; // using operator<<(...) cout << " the third character is: " << s[2] << "\n\n"; // using operator[](...) }