Swaranga Sarma wrote:Any other type other than Book must be invalid.
Stephan van Hulst wrote:You still have not explained why you want to restrict this. If Book wants to update using a User, or vice versa, then why should your interface care? If you want Book to use a Book, then you should write Book properly.
A supertype should not care about whether its children misbehave.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Luigi Plinge wrote:Swaranga - I'm just wondering how the Enum example that you give is any different? Couldn't you have two classes extending that which can compare each other? Perhaps for enumerations using the enum keyword, it's implemented in a way that can't be achieved through the Java language.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
And inside of my fortune cookie was this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
|