Skip to Content
avatar image
Former Member

difference bw operators

Could anyone pls explain me the difference b/w " -> " and " => " operator and significance

thanks in advance....

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Sep 04, 2008 at 08:06 PM

    -> is used to select instance components of Class

    => is used to select Static Component.

    Pl go through the link that I sent in the previous thread. You will find all answers there.

    Quted from SAP Library:

    Addressing the Components of Objects

    Programs can only access the instance components of an object using references in object reference variables. This is done using the object component selector -> (ref is a reference variable):

    · To access an attribute attr: ref->attr

    · To call a method meth: CALL METHOD ref->meth

    You can access static components using the class name or the class component selector => as well as the reference variable. It is also possible to address the static components of a class before an object has been created.

    · To access a static attribute attr: class=>attr

    · To call a static method meth: CALL METHOD class=>meth

    Note that the properties of instance attributes behave like static components. It is therefore possible to refer in a LIKE addition to the visible attributes of a class u2013 through the class component selector or through reference variables, without prior creation of an object.

    Each class implicitly contains the reference variable me. In objects, the reference variable mealways contains a reference to the respective object itself and is therefore also referred to as the self-reference. Within a class, you can use the self-reference me to access the individual class components:

    · To access an attribute attr of your class: me->attr

    · To call a method meth of your class: CALL METHOD me->meth

    When you work with attributes of your own class in methods, you do not need to specify a reference variable. The self-reference me is implicitly set by the system. Self-references allow an object to give other objects a reference to it. You can also access attributes in methods from within an object even if they are obscured by local attributes of the method.

    -- Reema.

    Add comment
    10|10000 characters needed characters exceeded