| Home | Previous Lesson: Overloading Next Lesson: Operational Polymorphism |
For this, you need to use inheritance. In function overriding, the function name and arguments are typically same (though they can be different), but the code inside the function is different. For example, you can define a 'Save' function in the 'data-entry-form' object at the higher level and can have different code in each of the derived object, by defining the same name with different code. Saving a master form needs to update only the master file, and saving a transaction form needs to update master file as well as transaction file. In cases like this, function overriding can be used. This is also called as 'inclusional polymorphism'.
| Home | Previous Lesson: Overloading Next Lesson: Operational Polymorphism |