Advanced PowerBuilder

HomePrevious Lesson: Function Overloading Using Inheritance
Next Lesson: Function Overriding

Function Overloading Without Using Inheritance

With version 5.0, you can define multiple functions with the same name and with different arguments, at the same object level. This reduces the overhead, because, there is no need to use complex inheritance hierarchy for one function overloading. Let us take the same example of MessageBox() function. You see multiple MessageBox() functions definition at the same object level, i.e., SystemFunctions class. In prior versions, Powersoft did the same thing, but didn't allow it for the developers. With version 5.0, developers are allowed to do the same. Other examples would be TriggerEvent(), PostEvent() defined at PowerObject.

However, it is not allowed if you try to overload the function just because the return data type is different.
HomePrevious Lesson: Function Overloading Using Inheritance
Next Lesson: Function Overriding