AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

super this

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java (Italian)
View previous topic :: View next topic  
Author Message
newEntry
Guest





PostPosted: Wed Feb 25, 2004 2:52 pm    Post subject: super this Reply with quote



super serve solitamente ad invocare il costruttore con qualche
argomento(quello di default viene invocato automaticamante dal runtime di
java quando viene costruito un oggetto derivato.. se sto sbagliando
corregetemi!!) dalla classe derivata es. super(arg1,..);con
super(arg1,..)invoco solo il costruttore della 1° classe genitrice e non
delle altre superclassi e di queste viene invocato quello di default?

Ho scaricato una classe dal sito della Sun:FileChooserDemo

con l'istruzione:
Back to top
Dario
Guest





PostPosted: Wed Feb 25, 2004 4:18 pm    Post subject: Re: super this Reply with quote



newEntry wrote:

Quote:
super serve solitamente ad invocare il costruttore con qualche
argomento(quello di default viene invocato automaticamante dal runtime di
java quando viene costruito un oggetto derivato.. se sto sbagliando
corregetemi!!) dalla classe derivata es. super(arg1,..);con
super(arg1,..)invoco solo il costruttore della 1° classe genitrice e non
delle altre superclassi e di queste viene invocato quello di default?

Ho scaricato una classe dal sito della Sun:FileChooserDemo

con l'istruzione:
.
int returnVal = fc.showOpenDialog(FileChooserDemo.this);
.
.
ad showOpenDialog viene passato cosa?
cosa fa FileChooserDemo.this?

L'uso qualificato di this e' spiegato in
http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#251603
Nel tuo caso FileChooserDemo.this == this
e quindi a fc.showOpenDialog viene passato this.

Quote:
this() viene usato solo in costruttore con argomenti per richiamre il
costruttore senza argomenti?

Tutti gli usi di this sono specificati in
http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#251519

Come hai detto tu this() viene usato solo in costruttore con argomenti
per richiamare il costruttore senza argomenti.

- Dario

Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java (Italian) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.