if (is_ptr)
{
cout << "Release Year: " << is_ptr->get_releaseYear() << endl;
cout << "Genre: " << is_ptr->get_genre_as_cstr() << endl;
}
Hi smart ones. I am getting here this "Access violation reading location" error when I calling the function get_genre_as_cstr()
.
Below is the definition of the function:
enum class GENRE { ANY, POP, JAZZ, ROCK, INDIE, ELECTROPOP };
const char* get_genre_as_cstr() const
{
static const char* GENRE_cstr[]{ "Any", "Pop", "Jazz", "Rock", "Electropop" };
return GENRE_cstr[(std::size_t)genre];
}
Could you please help me solve this ?
User contributions licensed under CC BY-SA 3.0