Although the extends keyword implies that you are going to add new functions to the
interface, that’s not necessarily true. The second way to differentiate your new class is to
change the behavior of an existing base-class function. This is referred to as overriding that
function.
To override a function, you simply create a new definition for the function in the derived
class. You’re saying “I’m using the same interface function here, but I want it to do
something different for my new type.”
Monday, July 28, 2008
Overriding base-class functionality
Posted by Ganesh Kumar Devarasetty at 11:19 AM
Labels: Introduction to Objects In Java
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment