class cstring
{
public:
cstring(char
*str="");
cstring(const cstring
&str);
cstring operator+(const cstring
&str);
//赋值运算符只能用成员函数重载,不能被继承,用户自己不重载系统会默认冲在一个(但不一定能满足要求)
cstring
&operator=(const cstring &str);
//重载函数调用运算符,只能用成员函数
int
operator()();
//重载下标运算符,只能用成员函数
char
operator[](int i);
void
print(void);
private:
char
*m_pstr;
int m_isize;
};
C++赋值运算符、函数调用运算符、下标运算符(“=”、“()”、“[]”)重载,布布扣,bubuko.com
C++赋值运算符、函数调用运算符、下标运算符(“=”、“()”、“[]”)重载
原文:http://www.cnblogs.com/de0319gh/p/3597636.html