class Song {
public:
const string getAutherName();
}
void mtm::RadioManager::addSong(const Song& song,const Song& song1) {
if (song.getAutherName() == song1.getAutherName())
}
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
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]
Run Code Online (Sandbox Code Playgroud)
它为什么使用basic_string而不是string!怎么解决这个问题?
我有一首我要复制的歌曲......
int mtm::Song::getLimitedLength(int maximum_length) {
Song copied_song(this);
this->Song(copied_song);
}
Run Code Online (Sandbox Code Playgroud)
我收到这个错误:
Multiple markers at this line
- candidates are:
- no matching function for call to 'mtm::Song::Song(mtm::Song* const)'
Run Code Online (Sandbox Code Playgroud)