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

static methods vs instant methods

Former Member
0 Likes
422

hi to all abap gurus

thanks in advance

all of the objects in the class can acess its its static attributes . and if u change the static attribute in an object the change is visible in all other objects in the calsssss.

can u pls expain this and tell the diffrence bewteen static and instance metod s?

1 REPLY 1
Read only

Former Member
0 Likes
301

Hi,

<b>Instance Method</b>

You can declare instance methods by using the METHODS statement. They play a very important role as they can access all of the attributes of a class and can trigger all of the events of the class.

<b>Static Methods</b>

You can declare static methods by using the CLASS-METHODS statement. They are important and can only access static attributes and trigger static events.

<b>STATIC METHODS</b>

CAN ONLY USE STATIC COMPONENTS IN THEIR IMPLEMENTATION PART

CAN BE CALLED USING THE CLASS

Static methods (also referred to as class methods) are called using CALL METHOD <classname>=><class_method>.

If you are calling a static method from within the class, you can omit the class name.

You access static attributes using <classname>=><class_attribute>

Regards,

Padmam.