Application Development 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: 

instance method and static method

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi IIhan,

You are right.

to call instance method:


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

to call static method


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

George

Former Member
0 Kudos

Hi,

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

-> is Object Component Selector

Regards

Former Member
0 Kudos

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...