class Song {
public:
const string getAutherName();
}
void mtm::RadioManager::addSong(const Song& song,const Song& song1) {
if (song.getAutherName() == song1.getAutherName())
}
我收到此错误:
Invalid arguments ' Candidates are: std::basic_string<char,std::char_traits<char>,std::allocator<char>> getAutherName() ' - passing 'const mtm::Song' as 'this' argument of 'std::string mtm::Song::getAutherName()' discards qualifiers [- fpermissive]
为什么它使用basic_string
而不是string
!如何解决这个问题?