‎2008 Mar 05 1:59 PM
when we use double arrow symbol (==>) and when we use single arrow symbol in OOPS concepts..
‎2008 Mar 06 4:17 AM
hI
-> Object Component Selector
To access instance components from outside the class using obj->comp.
ME->comp can be used to point to the instance components and static components of this class.
=> Class Component Selector
You can access the static components from outside the class with the expression class=>comp
Static Access
The following syntax applies (ref is a reference variable):
Access to an instance attribute attr: ref->attr
Calling an instance method meth: CALL METHOD ref->meth
In addition to reference variables, the class name can be used for access:
Accessing a static attribute attr: class=>attr
Calling a static method meth: CALL METHOD class=>meth
Dynamic Access
The following syntax applies (ref is a reference variable):
Calling an instance method meth: CALL METHOD ref->(f)
Calling a static method meth: CALL METHOD class=>(f) CALL METHOD (c)=>meth CALL METHOD (c)=>(f)
Calling own method meth: CALL METHOD (f) CALL METHOD ME->(f)
‎2008 Mar 05 2:11 PM
Hi
=> this is used for static methods and static attributes.
-> used for Instance methods and Instance attribute.
Instance components exist separately in each instance (object) of the class and are referred using instance component selector using '->'
.Static components only exist once per class and are valid for all instances of the class. They are declared with the CLASS- keywords
Static components can be used without even creating an instance of the class and are referred to using static component selector => .
See the below example u can better understand the concept:
REPORT YSUBOOPS17 .
CLASS c1 DEFINITION.
PUBLIC SECTION.
data : i_num type i value 5.
class-data :
s_num type i value 6 .
ENDCLASS.
CLASS c1 IMPLEMENTATION.
ENDCLASS.
START-OF-SELECTION.
DATA : oref1 TYPE REF TO c1 .
CREATE OBJECT : oref1.
write:/5 oref1->i_num.
write:/5 c1=>s_num .
write:/5 oref1->s_num.
<REMOVED BY MODERATOR>
Regards
Pratap.M
Edited by: Alvaro Tejada Galindo on Mar 5, 2008 6:13 PM
‎2008 Mar 06 4:17 AM
hI
-> Object Component Selector
To access instance components from outside the class using obj->comp.
ME->comp can be used to point to the instance components and static components of this class.
=> Class Component Selector
You can access the static components from outside the class with the expression class=>comp
Static Access
The following syntax applies (ref is a reference variable):
Access to an instance attribute attr: ref->attr
Calling an instance method meth: CALL METHOD ref->meth
In addition to reference variables, the class name can be used for access:
Accessing a static attribute attr: class=>attr
Calling a static method meth: CALL METHOD class=>meth
Dynamic Access
The following syntax applies (ref is a reference variable):
Calling an instance method meth: CALL METHOD ref->(f)
Calling a static method meth: CALL METHOD class=>(f) CALL METHOD (c)=>meth CALL METHOD (c)=>(f)
Calling own method meth: CALL METHOD (f) CALL METHOD ME->(f)