All pastes #753122 Raw Edit

Mine

public text v1 · immutable
#753122 ·published 2007-10-28 23:40 UTC
rendered paste body
Song& Song::operator=(const Song &S) {
      delete last_played;//last_played = NULL;
      last_played = S.getLastPlayed();
      title = S.getTitle();
      artist = S.getArtist();
      return *this;

}


last_played is a pointer to a class called Time
title and artist are just std::string


errors:
Song.cpp: In member function `Song& Song::operator=(const Song&)':
Song.cpp:54: error: passing `const Song' as `this' argument of `Time* Song::getLastPlayed()' discards qualifiers
Song.cpp:55: error: passing `const Song' as `this' argument of `std::string Song::getTitle()' discards qualifiers
Song.cpp:56: error: passing `const Song' as `this' argument of `std::string Song::getArtist()' discards qualifiers
*** Error code 1
make: Fatal error: Command failed for target `Song.o'