Вы находитесь на странице: 1из 2

report z745oops3.

Start-of-selection event
and calling a method from other method
class emp definition.
public section.
methods : m1,
m2.
protected section.
methods m3.
data : empno type i,
ename(20) type c.
endclass.
"emp DEFINITION
class emp implementation.
method m1.
empno = 8.
ename = 'ravi'.
*
call method k->m3. "k is not recognized
call method m3.
endmethod.
"m1
method m2.
*
write :/ me->empno,me->ename. "(or)
write :/ empno,ename.
endmethod.
"m2
method m3.
write :/ 'inside instance protected method m3'.
endmethod.
"m3
endclass.
"emp IMPLEMENTATION
start-of-selection.
data k type ref to emp.

create object k.
write :/ 'Object k.....'.
call method k->m2.
call method k->m1.
call method k->m2.
*call method k->m3. "m3 cannot be called as it is protected

uline.
data k1 type ref to emp.
create object k1.
uline.
write :/ 'Object k1.....'.
call method k1->m2.

Вам также может понравиться