‎2006 Oct 18 11:48 AM
Hi,
Do you know how to call a method of some object inside method of different object which takes reference to this first object.
class c1 definition.
public section.
methods m1.
endclass.
class c1 implementation.
method m1.
write 'method m1'.
endmethod.
endclass.
class c2 definition.
public section.
methods m2
importing p2 type ref to c1.
endclass.
class c2 implementation.
method m2.
p2->m1.
endmethod.
endclass.
Is it possible. Because I'm getting an error.
Regards,
Wojciech
‎2006 Oct 18 12:01 PM
It is possible:
YOu did a small mistake:
class c1 definition.
public section.
methods m1.
endclass.
class c1 implementation.
method m1.
write 'method m1'.
endmethod.
endclass.
class c2 definition.
public section.
methods m2
importing p2 type ref to c1.
endclass.
class c2 implementation.
method m2.
<b>call method</b> p2->m1.
endmethod.
endclass.
make the highlighted change.
Regards,
ravi
‎2006 Oct 18 11:56 AM
Its possible if you declare the method as public.
Only public methods can be called in other objects
class c2 implementation.
method m2.
p2->m1.
endmethod.
endclass.
It shouldnt be giving error.
can you give the code where you are calling the c2->m2 ?
‎2006 Oct 18 12:01 PM
It is possible:
YOu did a small mistake:
class c1 definition.
public section.
methods m1.
endclass.
class c1 implementation.
method m1.
write 'method m1'.
endmethod.
endclass.
class c2 definition.
public section.
methods m2
importing p2 type ref to c1.
endclass.
class c2 implementation.
method m2.
<b>call method</b> p2->m1.
endmethod.
endclass.
make the highlighted change.
Regards,
ravi
‎2006 Oct 18 12:32 PM