const string& mtm::RadioManager::getBestSong() const {
string& most_popular_song=tmp.getName();
most_popular_song = current_song.getName();
return most_popular_song;
}
string mtm::Song::getName() const {
return this->song_name;
}
class Song {
string song_name;
public:
string getName() const;
}
次のエラーが表示されます。
タイプ「std::string {aka std::basic_string}」の右辺値からのタイプ「std::string& {aka std::basic_string&}」の非定数参照の無効な初期化
に変えconst string& most_popular_song=tmp.getName();
てるから作れない このエラーを取り除くにはどうすればよいですか?tmp.getName();
string