class Song {
public:
const string getAutherName();
}
void mtm::RadioManager::addSong(const Song& song,const Song& song1) {
if (song.getAutherName() == song1.getAutherName())
}
I get this error:
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]
Why is it using basic_string and not string! how to fix this?
std::basic_string<...just is the actual thing used in the background. The error is still about your usage ofstd::string.==is overloaded and allows for string equality comparisons.c++not javastd::stringis just atypedefforstd::basic_string<char>getAutherName()isn't const, you can't call with those Song references AFAICT.