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

instance method and static method

Former Member
0 Likes
690

Hello Experts,

can you say you can call a

instance method with ->

and

static method =>

within the ABAP OO-Programming.

Or is it vice versa ?

Regards

ilhan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
619

Hi IIhan,

You are right.

to call instance method:


ref_obj->method_name
 EXPORTING
            .............

to call static method


ref_obj=>method_name
EXPORTING
      ---------

George

4 REPLIES 4
Read only

Former Member
0 Likes
619

Hi,

Its correct.

Refer

data instance_name type ref to class_name.

create object instance_name...

call method instance_name->instance_method( ... )

you may call static methods (also called class methods) only on class, does not need an instance

call method class_name=>static_method( ... )

Regards

Sumana

Read only

Former Member
0 Likes
620

Hi IIhan,

You are right.

to call instance method:


ref_obj->method_name
 EXPORTING
            .............

to call static method


ref_obj=>method_name
EXPORTING
      ---------

George

Read only

Former Member
0 Likes
619

Hi,

=> is used for accessing static component of a class. It is actually called Class Component Selector .

-> is Object Component Selector

Regards

Read only

Former Member
0 Likes
619

no need to worry much for this...

in abap editor click patern->ABAP Object patern->

give instance name, class name, method name which ever u need.

it will put the method skeleton for you...