2014年3月13日
摘要: #include #include #include using namespace std;class cstring{public: cstring(char *str=""); cstring(const cstring &str); cstring operator+(const cstring &str); //赋值运算符只能用成员函数重载,不能被继承,用户自己不重载系统会默认冲在一个(但不一定能满足要求) cstring &operator=(const cstring &str); //重载函数调用运算符,只能用成员函数 int 阅读全文
posted @ 2014-03-13 00:10 de0319gh 阅读(503) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;class String{public: String(const char *str = NULL);//默认构造函数 String(const String &str);//复制构造函数 ~String();//析构函数 String operator+(const String & str);//字符串连接 String & operator=(const String &str);//字符串赋值 bool operator==(const String &str);//判断是否字符串相等 阅读全文
posted @ 2014-03-13 00:06 de0319gh 阅读(571) 评论(0) 推荐(0) 编辑