Quick and stupid question. How do I declare the size for an array if I'm not allowed to use global variables?
Suppose I have the file Album.h:
class Album {
private:
Song songs[MAX_SONGS];
//...
}
where do I put MAX_SONGS = 30?
const int MAX_SONGS = 30
is considered a variable right?
Please notice that the size should be known to the entire program.
const int MAX_SONGS = 30;is considered to be aconstant. You could also use a#define MAX_SONGS 30pre-processor directive.std::vector<Song>and you don't have to define a max size.