C++自编String类代码

zhidc 34 0 TXT 2018-12-26 11:12:50

#include #include using namespace std; class String { public: String(); String(const char*const); String(int x); String(const String &rs); int getlen()const{return len;} const char* getstr()const{return str;} char& operator[](int lenth); char operator[](int lenth)const; String& operator=(const String &rs); String operator+(const String &); void operator+=(const String &); friend ostream& operatora.str; return i; } ~String(); private: int len; char *str; }; return s; } friend istream& operator>>(istream&i,const String&a) { i>>a.str; return i; } ~String(); private: int len; char *str; };

C++自编String类代码

用户评论
请输入评论内容
评分:
暂无评论