‎2009 Apr 07 4:56 AM
hi there,
can anyone pls tell me why overloading in not possible in ABAP?? they ve asked me this quetion in an interview..
regards,
Krish
‎2009 Apr 07 8:38 AM
>
> hi there,
>
> can anyone pls tell me why overloading in not possible in ABAP?? they ve asked me this quetion in an interview..
>
> regards,
> Krish
Because that's how SAP designed the ABAP Objects language. Overloading isn't needed anyway, because you can mark parameters as optional - this allows you to do anything that you could do with overloading.
matt
‎2009 Apr 07 7:27 AM
hi,
To test it do it this way.
First try create two methods in the same class with same name.
but there parameter should be different. mean one method contain only one import parameter another contain 2 parameter.
Now try to call them one by one by an object.
if you call them that mean overloading is possible otherwise not.
And Method OverLoading is Not possibel in ABAP Objects.
Reason: As Method overloading is done on the basis of number of parameters that you pass to the function.
but in ABAP Obejcts.
when you implement the class there is no differtiation between methods on the basis of number of parameters you want to pass.
Class xxx definition.
public section.
Method :
area importing len type i,
area importing len type c width type c.
endclass.
class xxx implementation.
Method area .
Endmethod.
endclass.
In the class implementaion ,we need to differentiate on the basis of number of parameters which we pass but we can not and only one one implemetation is possible for a function. so we can not have multiple functinalty inmplemented for a method with same name.
Regards.
Punit
Edited by: Punit Singh on Apr 7, 2009 8:33 AM
Edited by: Matt on Apr 7, 2009 9:36 AM - changed "function module" to "method"
‎2009 Apr 07 8:38 AM
>
> hi there,
>
> can anyone pls tell me why overloading in not possible in ABAP?? they ve asked me this quetion in an interview..
>
> regards,
> Krish
Because that's how SAP designed the ABAP Objects language. Overloading isn't needed anyway, because you can mark parameters as optional - this allows you to do anything that you could do with overloading.
matt