String::String( const char *s)
{
length=(((strlen(s)!=0)?( strlen( s )+1) : 2));
cout << "Conversion (and default) constructor: " << s << endl;
setString( s );
}单步调试时 到这个构造函数就通不过了 提示 Access Violation.
并且strlen(s)的Value显示:variable needs stack frame.
{
length=(((strlen(s)!=0)?( strlen( s )+1) : 2));
cout << "Conversion (and default) constructor: " << s << endl;
setString( s );
}单步调试时 到这个构造函数就通不过了 提示 Access Violation.
并且strlen(s)的Value显示:variable needs stack frame.
int a
String b( (char *)&a );
因为没有结束符的原因
2)这个函数本身有问题,length=(((strlen(s)!=0)?( strlen( s )+1) : 2));
(strlen(s)!=0)会等于0吗?
还有就是为什么是2,而不是1