Results 1 to 2 of 2
  1. #1
    alunina is offline Member
    Join Date
    Feb 2010
    Posts
    1
    Rep Power
    0

    Default Enum inheritance

    Hi!

    I'd like to make this data structure:

    enumBase{
    A,B,C;
    }

    enumExt{
    E,F,G;
    }

    I'd like enumExt(and there will be more ext.) to know about A,B,C but unfortunatelly the enum couldn't be extended. Is there any technic or design pattern for this?

    Thanks in advance!

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Enums should be used for constant values. It does not make sense to have an inheritance relationship between constants.

Similar Threads

  1. enum
    By billq in forum New To Java
    Replies: 3
    Last Post: 01-03-2010, 08:38 PM
  2. Enum example
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-17-2008, 07:34 PM
  3. How to use enum
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-17-2008, 07:34 PM
  4. enum to array
    By eva in forum New To Java
    Replies: 2
    Last Post: 12-22-2007, 06:50 PM
  5. Enum?
    By vgbhagavan in forum Advanced Java
    Replies: 0
    Last Post: 06-14-2007, 02:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •