Key concept of this example
- overloading a method
- super class original method()--- no parameter
- derived class original method(variable-type variable)
- this key word to a method
- this refer to super class
- this.method() --refers to superclass.method
-
- use of overloaded methods :
- in the same class or a subclass
- the method in the derived class, would have the same method name
used in a base class
- the method in the derived class, would have the same name, but would
have different parameter lists,
- the method in the derived class, would have the same name, can have
different return types .
Also see overloading a constructor:
Link |