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: 

oops-method overloading

Former Member
0 Kudos

Is there any phenomenon by name method overloading in abap like java.If it was there can any body explain it in detail,or if it was not there ,then is there any other phenomenon which have a similar functionality like method overloading.

2 REPLIES 2

Former Member
0 Kudos

there is no overloading in abap oops

Former Member
0 Kudos

Hi Sandeep,

There is no method overloading in ABAP./ But there is something called a redefinition.

When you inherit a class from a super class, you can redifne a method. You cannot chnage the signature( Interface) of the method. It will remain the same as that of the super class.You must redefine a method in the same visibility section in which it appears in the superclass.

Eg.

CLASS C_SUPER_CLASS DEFINITION .

PUBLIC SECTION.

METHODS: DRIVE ,

STOP.

PROTECTED SECTION.

DATA SPEED TYPE I.

ENDCLASS.

CLASS C_SUPER_CLASS IMPLEMENTATION.

METHOD DRIVE.

SPEED = 0.

WRITE: / 'Bike speed =', SPEED.

ENDMETHOD.

ENDCLASS.

CLASS C_SUB_CLASS DEFINITION INHERITING FROM C_SUPER_CLASS.

PUBLIC SECTION.

METHODS DRIVE REDEFINITION.

ENDCLASS

CLASS C_SUB_CLASS IMPLEMENTATION.

METHOD DRIVE.

SPEED = SPEED + 10.

WRITE: / 'Bicycle speed =', SPEED.

ENDMETHOD.

ENDCLASS.