摘要:
#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 阅读全文
摘要:
#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);//判断是否字符串相等 阅读全文