Application Development and Automation 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: 
Read only

Class concept

Former Member
0 Likes
1,825

when we use double arrow symbol (==>) and when we use single arrow symbol in OOPS concepts..

1 ACCEPTED SOLUTION
Read only

Former Member
993

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)

2 REPLIES 2
Read only

Former Member
0 Likes
993

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

Read only

Former Member
994

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)