The document defines a class called 'emp' with two public methods 'm1' and 'm2' and two protected data members 'empno' and 'ename'. It then creates two objects 'k' and 'k1' of type 'emp' and calls their methods to demonstrate the class implementation.
The document defines a class called 'emp' with two public methods 'm1' and 'm2' and two protected data members 'empno' and 'ename'. It then creates two objects 'k' and 'k1' of type 'emp' and calls their methods to demonstrate the class implementation.
The document defines a class called 'emp' with two public methods 'm1' and 'm2' and two protected data members 'empno' and 'ename'. It then creates two objects 'k' and 'k1' of type 'emp' and calls their methods to demonstrate the class implementation.
methods (Class Implementation at the end) class emp definition. public section. methods : m1, m2. protected section. data : empno type i, ename(20) type c. endclass.
data k type ref to emp.
create object k. *write :/ k->empno. "syntax error as empno is protected write :/ 'Object k.....'. call method k->m2. call method k->m1. call method k->m2. data k1 type ref to emp. create object k1. uline. write :/ 'Object k1.....'. call method k1->m2. class emp implementation. method m1. empno = 8. ename = 'ravi'.
endmethod. method m2. *
write :/ me->empno,me->ename." 'me' referes to current object in execution (or)