Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Method OverLoading

Former Member
4,268

Hi friends,

Is Method OverLoading is possible in ABAP OOPS?

If possible give me an example?

1 ACCEPTED SOLUTION

Former Member
1,049

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.

9 REPLIES 9

Former Member
1,050

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.

Former Member
0 Kudos
1,049

Method Overloading is not possible using ABAP OO.

Thanks,

Balaji

0 Kudos
1,049

Hi friends,

But why this method overloading is not possible in ABAP OO?

0 Kudos
1,049

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

matt
Active Contributor
1,049

You can get something approaching method overloading using optional parameters. Why isn't overloading allowed? Because SAP designed ABAP Objects that way.

matt

Former Member
0 Kudos
1,049

thanks

Former Member
1,049

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

0 Kudos
1,049

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