Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

private and protected enums

 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I declared an instance enum with private/protected access modifier, The compiler did not flag any error. Whereas in the chapter one its mentioned that enums can only have public and default access. Can any one please clear my confusion?
Thanks
Deepak
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter one? Of what book? Possibly the book means that enums declared at top level can only be default or public?
 
Ramamoorthy Periasamy
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I declared an instance enum with private/protected access modifier, The compiler did not flag any error. Whereas in the chapter one its mentioned that enums can only have public and default access. Can any one please clear my confusion?


If the enum declared out outside class then it should have only public or default access. Whereas, if the enum declared inside class then it may have private and protected too
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic