Skip to Content
avatar image
Former Member

Calling the super class method from the subclass

Hi all,

I have a question about inheritence and redefinition of methods. Is it possible to call the superclass implementation of a method which is redefined in the subclass in another method of the subclass?There are possbilities like creation of an explicit super class instance or delegating the super class method implementation to another method which is also protected etc. What i mean is, is there a direct way of calling it?We have ,me, as the reference for the instance we have(which is the subclass instance in this case), is there also a way of pointing the superclass implementation(with super we can reference in the subclass redefinition, my question is if we have such a parameter in other methods of the subclass too)

Thanks in advance

Sukru

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Sep 04, 2008 at 02:31 PM

    Hi,

    The super reference can only be used in redefined methods to call superclass implementation . So probably what you can do is use upcasting and access the required superclass implementation. I can think of only this way...;-)

    Ex data lr_super type ref to cl_superclass

    lr_super = lr_subclass.

    lr_super->method().

    ~Piyush Patil

    Add comment
    10|10000 characters needed characters exceeded