how to write a methods class that calls the supperclass's by using a reserved word?
Answers
jack573
On 2006-08-15 08:44:19
If you are using java you would use the keyword 'super'.
For instance you had these classes.
class Parent
with a method
setName(String name)
class Child extends Parent
with a method that overwrites the Parent's method
setName(String name)
Now, if you set the name of the Child class, the code in the method would/should have the next line as the first line.
super.setName(name);
This calls the Parent's (superclass') method using a reserved word.
With regards to reuseable classes and packages. If you create the Parent and do not change it or only change it rarely, but use it in different applications, then you have 'reused' the Parent as a reuseable class. If the Parent is part of a package, and may include Child, and that package is not changed, or changed rarely, then you have a reusable package.
Answers
jack573
On 2006-08-15 08:44:19