F
Fred
Cadenhead in "Sams Teach Yourself Java 2 in 24 hours" writes that
'super...can be used...to refer to a variable of the superclass, as in
super.hawaii = 50.'
I don't understand why this is in general, possible. If an instance of
the subclass has been created, it cannot be assumed that an instance
of the superclass has been simultaneously created. If an instance of
the superclass has not been created, then the above statement doesn't
make sense. The assumption is that the hawaii variable is static,
right?
And I don't understand why an assignment to a superclass's variable
would *ever* need to be made *by* the subclass. If the variable is not
static, the variable has been inherited - playing around with that
'copy' of the variable should suffice for all purposes, should it not?
TIA,
Fred
'super...can be used...to refer to a variable of the superclass, as in
super.hawaii = 50.'
I don't understand why this is in general, possible. If an instance of
the subclass has been created, it cannot be assumed that an instance
of the superclass has been simultaneously created. If an instance of
the superclass has not been created, then the above statement doesn't
make sense. The assumption is that the hawaii variable is static,
right?
And I don't understand why an assignment to a superclass's variable
would *ever* need to be made *by* the subclass. If the variable is not
static, the variable has been inherited - playing around with that
'copy' of the variable should suffice for all purposes, should it not?
TIA,
Fred