ok I am getting an error that says
Code:
linker error undefined reference to 'Song::artist'
but I am not sure where in the code it is...
Code:
//song.h
#ifndef SONG_H
#define SONG_H
#include <stdlib.h>
#include <iostream>
#include <ostream>
#include <string>
//#include "BobCatPod.h"
using namespace std;
//std::ostream;
class Song
{
private:
string title; //dynamic allocation
string artist;
int size;
public:
Song();
Song(string , string , int ); // constructor
void setSize(int s);
int getSize(); // access or
void setTitle (string t);
string getTitle();
void setArtist (string a);
string getArtist();
void addSong (int);
friend ostream& operator<<(ostream & os, const Song &s)
{
os << title;
os << artist;
os << size;
return os;
}
bool operator==(const Song& lhs)
{
if (strcmp (artist, lhs.artist) == 0)
{if (strcmp (title, lhs.title) ==0)
{if (size == lhs.size)
return true;
}
}
return false;
}
bool operator<(const Song& lhs)
{
if (artist < lhs.artist)
{ return true;
}
else if (artist > lhs.artist)
{
return false;
}
else if (title < lhs.title)
{
return true;
}
else if (title > lhs.title)
{
return false;
}
else if (size < lhs.size)
{
return true;
}
else
{
return false;
}
}
};
#endif