-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSong.cpp
More file actions
68 lines (56 loc) · 1.13 KB
/
Song.cpp
File metadata and controls
68 lines (56 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <iostream>
#include <string>
#include "Song.h"
#include "Artist.h"
#include "Album.h"
int Song::total_songs = 0;
Song::Song() : song_name(""), album_name(""), artist_name(""), song_time(0.0)
{
total_songs++;
}
Song::Song(const std::string &s, const Artist &a, const Album &alb) : song_name(s), artist_name(a), album_name(alb)
{
total_songs++;
}
Song::~Song()
{
}
void Song::set_artist(Artist &artist)
{
artist_name = artist;
}
void Song::set_album(Album &album)
{
album_name = album;
}
Artist Song::get_artist() const
{
return artist_name;
}
Album Song::get_album() const
{
return album_name;
}
void Song::set_time(float time)
{
song_time = time;
}
float Song::get_time() const
{
return song_time;
}
int Song::get_total_songs()
{
return total_songs;
}
bool Song::operator==(const Song &s) const
{
if (song_name == s.song_name && artist_name == s.artist_name && album_name == s.album_name)
return 1;
return 0;
}
std::ostream &operator<<(std::ostream &out, const Song &s)
{
out << s.song_name;
return out;
}