Application Development and Automation 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: 
Read only

method

Former Member
0 Likes
318

can any one send some important data regarding method overloading and method overriding in abap,its urgent please.

1 REPLY 1
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
295

Hi,

There is no METHOD OVERLOADING in the ABAP.

Since you can get the same behaviour with the help of OPTIONAL parameters.

METHOD OVERRIDING is called REDEFINITION in ABAP.

Here is an example

CLASS c1 DEFINITION.

PUBLIC SECTION.

METHODS m1 IMPORTING p1 TYPE string.

PRIVATE SECTION.

DATA a1 TYPE string VALUE `c1: `.

ENDCLASS.

CLASS c2 DEFINITION INHERITING FROM c1.

PUBLIC SECTION.

METHODS m1 REDEFINITION.

PRIVATE SECTION.

DATA a1 TYPE string VALUE `c2: `.

ENDCLASS.

CLASS c1 IMPLEMENTATION.

METHOD m1.

CONCATENATE a1 p1 INTO a1.

WRITE / a1.

ENDMETHOD.

ENDCLASS.

CLASS c2 IMPLEMENTATION.

METHOD m1.

super->m1( p1 ).

CONCATENATE a1 p1 INTO a1.

WRITE / a1.

ENDMETHOD.

ENDCLASS.

START-OF-SELECTION.

DATA oref TYPE REF TO c1.

CREATE OBJECT oref TYPE c2.

oref->m1( `Testing` ).

Regards,

Sesh