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.
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.