A superclass is not responsible for the subclass. A superclass is not obligated to make sure that a subclass will work logically or correctly. As long as a class's equals method adheres to the equals contract, it is valid irrespective of what the subclass does.
Equals contract does not mandate that a class and its subclass objects must work well when added to a Set. So just because adding GoodOne and ExtendedGoodOne objects in a Set is not working as per your expectation, doesn't mean GoodOne's equals implementation is invalid.
HTH,
Paul.
About Question enthuware.ocpjp.v8.2.1340 :
Moderator: admin
-
- Site Admin
- Posts: 10036
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1340 :
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 43 guests