#include<iostream>
using namespace std;
class String
{
public:
String ( const char *c = NULL);
~String ();
bool operator!() const;
private:
char *elems;
};
String::String(const char *c)
{
elems = c;
}
String ::~String()
{}
bool String::operator!() const
{
if(elems == NULL)
return true;
else
return false;
}
int main(void)
{
String str;
if(!str)
cout<<"这是一个空字符串!"<<endl;
return 0;
}
程序出错了,是char* 不能赋值给 const char * 这种错误怎么改 (最好不把const删掉),谢谢各位