Anda di halaman 1dari 1

report z745oops10.

instance and static


methods
class abc definition.
public section.
methods m1.
class-methods m2.
protected section.
data x type i.
class-data y type i.
constants z type i value 10.
endclass.
class abc implementation.
method m1.
write :/ 'inside instance method...'.
x = 10.
y = 20.
write :/ x,y,z.
endmethod.
method m2.
write :/ 'inside static method...'.
*
x = 12. "syntax error
y = 30.
write :/ y,z.
endmethod.
endclass.
start-of-selection.
write :/ 'static method accessed using class...'.
call method abc=>m2.
uline.
write :/ 'using object...'.
data ob type ref to abc.
create object ob.
call method : ob->m1,
ob->m2.

Anda mungkin juga menyukai