Hi, All,
I don't understand super(), it is a overdrive? SO I can use a
variable name that the same as class?
Best regards,
Boki.
klynn47@comcast.net - 21 Mar 2005 18:16 GMT
In the context super(), you would be calling a no argument constructor
of the superclass. This call would have to be the first exectuble line
in the subclass constructor.
Basically this use of super allows you to use the code from a
superclass constructor to initialize the variables inherited from the
superclass, and the rest of the subclass constructor can be used to
initialize the variables added in the subclass.
Thomas Kellerer - 21 Mar 2005 19:01 GMT
Boki wrote on 21.03.2005 17:42:
> Hi, All,
> I don't understand super(), it is a overdrive? SO I can use a
> variable name that the same as class?
>
> Best regards,
> Boki.
<http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#229267>
Hal Rosser - 21 Mar 2005 22:42 GMT
> Hi, All,
> I don't understand super(), it is a overdrive? SO I can use a
> variable name that the same as class?
>
> Best regards,
> Boki.
its just a call to the no-arg constructor of the parent class. It needs to
be the first line in the constructor of the derived class - if its used at
all. Don't worry - you'll get it sooner or later.