this is my superclass where i created an private enum
public class Media {
private String Title;
private enum Genre { Comedy, Horror, Action, Romance, Documentary, Thriller, Drama}
Genre genre;
public Media ()
{
}
public Media(String t, Genre g){
this.Title=t;
genre=g;
}
now i wanna use this in an subclass
public class Movies extends Media{
private String regi;
private int playtime;
public Movies(){
}
public Movies(String t, Genre g, String r, int playt)
{
setTitle(t);
genre=g;
this.regi=r;
this.playtime=playt;
}
but it is not working because its telling me that the enum is private when i send in the genre for the method of creating an Movie object? is it not possible to have a private enum and not use it in other classes or subclasses?
Make the enum protected
instead of private
protected enum Genre { Comedy, Horror, Action, Romance, Documentary, Thriller, Drama}
Private
means only accessible in the class its declared.
Protected
is same as private but derived classes have access to.
Public
means access to all