Google Search - Blog...........

ABAP - Class That Can Be Instantiated Within Implementation Of Another Class.

REPORT YSUBOOPS17 .

class class1 definition.
public section.
methods : method1 .
endclass.

class class2 definition.
public section.
methods : method2 .
endclass.

class class1 implementation.
method :method1.
data : i_num type i value 2.
write:/5 i_num.
endmethod.
endclass.

class class2 implementation.
method : method2.
data : obj1 type ref to class1.
create object obj1.
call method obj1->method1.
endmethod.
endclass.

start-of-selection.
data : my_obj type ref to class2.
create object : my_obj.
call method my_obj->method2.


Output 2

No comments:

Post a Comment