• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Enum in private inner class.

 
Garrett Smith
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do I get a compiler error by putting enum SortKey inside the inner class?



Error:The member enum SortKey must be defined inside a static member type
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
enums are implicitly static
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...and inner classes cannot have static members. Logical consequence is that inner classes cannot declare enums.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic