This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Covariant returns

 
Sathya Shanmugam
Ranch Hand
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,

Could any give more examples for covariant returns, Any link would be appreciated..


thanks
 
Sathya Shanmugam
Ranch Hand
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And also like to have some explanation with example for the following statement from KB book

" Overriding methods can do so only within the bounds of covariant returns"...
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sathya,

" Overriding methods can do so only within the bounds of covariant returns"...




New Thing to learn: You may have heard of bridge method; How does JVM handle to call the overridden method with covariant return type; The compiler automatically inserts the following in the subclass(in out example)

Animal meth() {
return this.meth();
}


Hope you got the concept!

Thanks & Regards,
cmbhatt
 
Sathya Shanmugam
Ranch Hand
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks chan for your immediate reply

I don't know what is a bridge method :roll:
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic