Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Override constructor in a enum  RSS feed

 
Elier Rguez
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am curious about if there is any way to implement a new constructor for a particular item in a enum. Like it's possible to override a method.


Thanks in advance.

 
Jack McLaren
Greenhorn
Posts: 13
Mac Mac OS X Mac PPC
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Elier Rguez wrote:Hello,
I am curious about if there is any way to implement a new constructor for a particular item in a enum. Like it's possible to override a method.


Thanks in advance.



Do you know that constructors can be overloaded but not overridden ?
 
Ben Pheonix
Ranch Hand
Posts: 46
1
Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Good answer. No there is no way you can provide a separate constructor for an enum element. Additionally constructors are overloaded
not overriden.

HTH,
Ben
 
Elier Rguez
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!