Code: Select all
enum Genre { DRAMA, THRILLER, HORROR, ACTION }; //***i.e. not static
Code: Select all
new Movie("Titanic", Movie.Genre.DRAMA, 'U'),
new Movie("Psycho", Movie.Genre.THRILLER, 'U'),
new Movie("Oldboy", Movie.Genre.THRILLER, 'R'),
new Movie("Shining", Movie.Genre.HORROR, 'U'));
static members: can use enclosing class' name
non-static members: must use instance of enclosing class
but it still worked.
And also if have:
Code: Select all
new Movie("Titanic", new Movie().Genre.DRAMA, 'U'),
Is there an explanation for this? :/