I need to output the information I got from the file back to a new file. But I am having understanding how to use the get command. ex. song[i].getLast();
I am getting undefined reference for the 3 get variables I am using.
class Quote
{
public:
Quote(); //this is a declaration
string getFirst(); //this is a declaration
string getLast(); //this is a declaration
string getQ(); //this is a declaration
void set(string l,string f,string qu) //this is a definition
{
last=l;
first=f;
q=qu;
}
voidoperator=(Quote); //this is a declaration
intoperator==(Quote); //this is a declaration
intoperator>(Quote); //this is a declaration
private:
string last;
string first;
string q;
};
Quote::Quote() //this is a definition
{
first="First";
last="Last";
q="Quote";
}
/*void Quote::operator ==(Quote song) //this is a definition
{
}*/
You need to write the code for the actual method, to tell it what to do. The compiler can't magically read your mind to find out what you want it to do and write it for you.
If you want a function called getFirst() that returns the value of first, then write it to do that. If you want it to do something else, then write that instead.