Skip to Content
author's profile photo Former Member
Former Member

oops-method overloading

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jul 03, 2007 at 10:45 AM

    there is no overloading in abap oops

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 03, 2007 at 11:23 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.