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

"this" and "super"

 
Rajiv Goyal
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sometimes confused with these key words?Can you please:
a)Let me know salient features of both "separately"
b)Differnce between two
Thanks
Rajiv
 
Damien Howard
Ranch Hand
Posts: 456
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me know salient features of both "separately"
"this" is an implicit reference to the current object. all Objects have a this reference. It can be used to pass a reference to the current object to a method in another object.
super is used to refer to the parent class of the current object. This is useful if you wish an overriding method to refer to the version of the method in the parent class.
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
also this() and super() play a key role in constructor.
Check out the JLS for more info and a lil example: �8.8.5 Constructor Body
 
Anupam Sinha
Ranch Hand
Posts: 1090
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rajiv
There is no this in a static reference, for example the main() method.
[ August 08, 2003: Message edited by: Anupam Sinha ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic