关于返回const的引用:
char& word::operator[](int index) const
{
if(index<0 || index>9)
throw "Wrong word index!\n";
else
return data[index];
}
出错:d:\Cpp_works\exem5\digital_network.cpp(63) : error C2440: “return” : 无法从“const char”转换为“char &”
转换丢失限定符
而这个我是参考c++ primer 上的string类的写法写的啊
为什么他可以呢?