0
class recording
{
public:
    void setTitle(const string &);
    void setArtist(const string &);

    string getTitle(void) const;
    string getArtist(void) const;

private:
    string title;
    string artist;
};


void recording::setTitle(string & pTitle)
{
    title = pTitle;
}

This is telling me that my declaration is incompatible with my function header. But if I don't use the scope resolution operator it says title is undefined. This doesn't make sense to me cuz that is how you declare a member function.

1 Answers1

4

The const makes the difference. You have declared:

void setTitle(const string &);

but you tried to define:

void recording::setTitle(string & pTitle)
LihO
  • 41,190
  • 11
  • 99
  • 167