diff options
Diffstat (limited to 'string.h')
-rw-r--r-- | string.h | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -8,12 +8,10 @@ #include <cstring> #include <iostream> -using namespace std; - class MyString { friend bool operator==(const MyString&, const MyString &); - friend ostream& operator<<(ostream&, const MyString &); + friend std::ostream& operator<<(std::ostream&, const MyString &); private: char *str_; @@ -36,13 +34,14 @@ class MyString MyString& concat(const char *); void printStr(void) const; - MyString operator!() const; + bool operator!(void) const; char& operator[](int); char operator[](int) const; + operator char*(); /* outward class conversion into char * */ }; bool operator==(const MyString&, const MyString &); -ostream& operator<<(ostream&, const MyString &); +std::ostream& operator<<(std::ostream&, const MyString &); inline MyString::MyString() { @@ -66,7 +65,7 @@ inline int MyString::length() const inline void MyString::printStr(void) const { - cout << "length: " << length_ << ", value: \"" << str_ <<"\""; + std::cout << "length: " << length_ << ", value: \"" << str_ << "\""; } #endif |