Final warning. Please use a more meaningful subject in future. And please don't use "hi ppl" in the subject.
hi ppl,
To access the private class one method is to declare the methods in public section and data in private section.But how can i access fi i declare the methods and data in private section itself.I think,the answer is with in that class itself.below is the code i sis so far,but iam unable to achieve the value that is in variable 'sum'.pls iam a new to oops concept..guide me
REPORT Y_OOPS_FOR_DEMO.
* public section.
data: a type i value 1,
b type i value 2,
C type i,
SUM TYPE I.
class cl definition.
private section.
methods: zdev importing c type i
* D TYPE I
exporting a type i
b type i.
endclass.
class cl implementation.
method zdev.
sum = a + b.
endmethod.
endclass.
data: m type i.
class dev1 definition inheriting from cl.
public section.
data: k type i value 10.
methods: asm.
endclass.
class dev1 implementation.
method asm .
m = sum + k.
write:/ 'THE VALUE OF sum IS ', m.
endmethod.
endclass.
DATA: OBJ TYPE REF TO dev1.
* DATA: OBJ1 TYPE REF TO cl.
START-OF-SELECTION.
CREATE OBJECT: OBJ.
CREATE OBJECT: OBJ1.
END-OF-SELECTION.
CALL METHOD OBJ->asm.
Edited by: Matt on Dec 1, 2008 4:21 PM
Edited by: Matt on Dec 1, 2008 4:37 PM