2008 Mar 20 6:57 AM
Hi friends,
Is Method OverLoading is possible in ABAP OOPS?
If possible give me an example?
2008 Mar 20 8:23 AM
hi,
ABAP Objects Concepts
Classical Object Model (like C++, Java, )
l Attributes, methods and events (instance and classlevel)
l Single inheritance for classes
l Interfaces, nested interfaces
l Integration with GUI and persistence
l No method overloading
l Garbage collection
l Hybrid language
Hope this helps, Do rewards.
2008 Mar 20 8:23 AM
hi,
ABAP Objects Concepts
Classical Object Model (like C++, Java, )
l Attributes, methods and events (instance and classlevel)
l Single inheritance for classes
l Interfaces, nested interfaces
l Integration with GUI and persistence
l No method overloading
l Garbage collection
l Hybrid language
Hope this helps, Do rewards.
2008 Mar 20 9:19 AM
2008 Mar 20 11:50 AM
Method Overloading is not possible using ABAP OO.
Thanks,
Balaji
2008 Mar 21 5:25 AM
Hi friends,
But why this method overloading is not possible in ABAP OO?
2008 Mar 24 8:51 AM
Hi Suresh,
As per SAP,
At this point, we should point out that methods in ABAP Objects cannot be overloaded. In other words, you cannot use the same method names with different parameter interfaces, even when you redefine methods in subclasses.
Some other object-oriented programming languages permit the overloading of functions or methods. This means that a separate, changed parameter interface can be defined for an overwritten or redefined method. ABAP Objects does not currently support this mechanism.
Hope this helps. Reward points if helpful.
Thanks,
Balaji
2008 Mar 25 8:31 AM
You can get something approaching method overloading using optional parameters. Why isn't overloading allowed? Because SAP designed ABAP Objects that way.
matt
2008 Mar 26 4:16 AM
2008 Mar 26 4:33 AM
Hi
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,
Deepak
2012 Jan 19 4:25 PM
Hi All,
The reason is simple------
-
Because sap has provided optional parameter option for Import parameters of method.
-
Edited by: rajeev ranjan from palamau on Jan 19, 2012 5:25 PM