Reputation: 1
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.
Upvotes: 0
Views: 36
Reputation: 42083
The const
makes the difference. You have declared:
void setTitle(const string &);
but you tried to define:
void recording::setTitle(string & pTitle)
Upvotes: 4