This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Harikrishna Gorrepati wrote:Hi, Why can't I do this? Error is in the comments.
It is not an override, because the super class add method takes an E instance as it's it parameter -- and in your example, it takes a Person object. So, technically, it should be a overload, one for Person and one for Object.
Unfortunately, it can't be an overload either. Because of type erasure, both methods come out to the same signature.