Ankitt Gupta wrote:Covariant type means your return type of the overriding method should be subclass of the return type of overridden method
I would say Ankitt it may be a subclass be not that it should be.
be a well encapsulated person, don't expose your privates, unless you public void getWife()!
Joined: Dec 16, 2008
Or it could be an implementing class, or an extending interface, if the return type of the overridden method is an interface. The key is that the covariant return must pass the Is-A test for the return type of the overridden method.
All code in my posts, unless a source is explicitly mentioned, is my own.