Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- StringBad & StringBad::operator=(const StringBad & st)
- {
- cout<<"**********USANDO O OPERADOR************";
- if (this == &st) // object assigned to itself
- return *this; // all done
- delete [] str; // free old string
- len = st.len;
- str = new char [len + 1]; // get space for new string
- std::strcpy(str, st.str); // copy the string
- return *this; // return reference to invoking object
- }
- StringBad headline1("Celery Stalks at Midnight");
- StringBad knot;
- knot =(headline1);
- cout << "knot: " << knot << endl;
- cout << "Exiting the block.n";
- cout << "End of main()n";
- knot = headline1;
- cout << "knot: " << knot = headline1 << endl;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement