string()是什么错误
string()是什么东东
有一个类 hasptr,此类有一个构造函数是这么写
hasptr(const string &s=string ()):ps(new string(s)),i(0){}
数据成员有:
private:
string *ps;
int i;
这个构造函数怎么理解啊,string()?
------解决方案--------------------
std::string的默认构造函数。
std::string
(1) empty string constructor (default constructor) string();
Constructs an empty string, with a length of zero characters.
有一个类 hasptr,此类有一个构造函数是这么写
hasptr(const string &s=string ()):ps(new string(s)),i(0){}
数据成员有:
private:
string *ps;
int i;
这个构造函数怎么理解啊,string()?
------解决方案--------------------
std::string的默认构造函数。
std::string
(1) empty string constructor (default constructor) string();
Constructs an empty string, with a length of zero characters.