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: 

OOPS Syntax

sujeet2918
Active Contributor
0 Kudos

Hi All,

I am new on OOPS.

What is the difference between below syntax, when we use "->" and "=>"?

eg :lcl_airplane=>display_n_o_airplane( ).

and r_plane->set_attributes( im_name = 'AA New York'

im_planetype = '747-400' ).

Thanks in Advance.

Sujeet

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Sujeet,

'->' is used to call a instance method, in this case you have to create the instance of the class object. If you create a local class, methods created using the key word 'METHODS' will be called using '->'

'=>' is used to call a static method, in this case you do not have to create the instance of the class object. If you create a local class, methods created using key word 'CLASS-METHODS' will be called using '=>'.

Regards,

George

3 REPLIES 3

Former Member
0 Kudos

hi Sujeet,

Instance methods are called using CALL METHOD <reference>-><instance_method>.

Static methods are called using CALL METHOD <classname>=><class_method>.

Static methods are addressed by class name, since they do not need instances.

Regards,

Runal

Former Member
0 Kudos

Hi Sujeet,

'->' is used to call a instance method, in this case you have to create the instance of the class object. If you create a local class, methods created using the key word 'METHODS' will be called using '->'

'=>' is used to call a static method, in this case you do not have to create the instance of the class object. If you create a local class, methods created using key word 'CLASS-METHODS' will be called using '=>'.

Regards,

George

sujeet2918
Active Contributor
0 Kudos

Thanks