Help With Enum Type & Classes
I just started doing classes and need some help with the last part of this program.
=================
1) In my header file I have this enum type and code (I'm posting the hole ".h" file so you know what I have):
Code:
enum Category {RnB, HipHop, Soul};
class Music
{
public:
Music();
Music(string, string, string, int);
void Set(string song, string album, string singer, int length);
string songTitle() const;
string cdTitle() const;
string artistName() const;
int PlayTime() const;
bool Compare(Music song2) const;
Category MusicType(Music genre) const;
private:
string title;
string cd;
string artist;
int time;
};
2) Enum code in Implentation File:
Code:
Category Music::MusicType(Music genre) const
{
switch (MusicType(genre))
{
case RnB: cout << "Genre: R & B";
break;
case HipHop: cout << "Genre: Hip Hop";
break;
case Soul: cout << "Genre: Soul";
break;
}// End of Switch
}
In my main program it outputs some info of two songs that I declared. Now, am I coding it right in the implementation file? Or should that code actually be in the main program and something else in the impl.file? If it's right what Im not able to do is call the enum type to output the genre for each song. How can I do that?
In my main program I have declared these two:
Code:
int main()
{
Music s1;
Music s2;
s1.Set("Let's Stay Together", "The Definitive Greatest Hits",
"Al Green", 3);
s2.Set("It's Bigger Than Hip Hop", "Let's Get Free", "Dead Prez", 4);
cout <<...