Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

me

Former Member
0 Likes
368

hi,

i just want to know if 'me' becomes an instance/object (self reference) when there is a create object of the class happens.

in this case, create object in start-of-selection, after the create object, client_ref is 9<client>, when debug steps in client class, 'me' is 9<client>.

if there is no create object in start-of-selection of the class then 'me' is unidentified and not an instance. correct?

thanks

REPORT self_reference.

----


  • CLASS client DEFINITION

----


  • ........ *

----


CLASS client DEFINITION.

PUBLIC SECTION.

DATA name(10) TYPE c VALUE 'master' READ-ONLY.

METHODS create_server.

ENDCLASS.

----


  • CLASS server DEFINITION

----


  • ........ *

----


CLASS server DEFINITION.

PUBLIC SECTION.

METHODS acknowledge IMPORTING creator TYPE REF TO client.

PRIVATE SECTION.

DATA name(10) TYPE c VALUE 'servant'.

ENDCLASS.

----


  • CLASS client IMPLEMENTATION

----


  • ........ *

----


CLASS client IMPLEMENTATION.

METHOD create_server.

DATA server_ref TYPE REF TO server.

CREATE OBJECT server_ref.

CALL METHOD server_ref->acknowledge EXPORTING creator = me.

ENDMETHOD.

ENDCLASS.

----


  • CLASS server IMPLEMENTATION

----


  • ........ *

----


CLASS server IMPLEMENTATION.

METHOD acknowledge.

DATA name TYPE string.

name = creator->name.

WRITE: me->name, 'created by', name.

ENDMETHOD.

ENDCLASS.

DATA client_ref TYPE REF TO client.

START-OF-SELECTION.

CREATE OBJECT client_ref.

CALL METHOD client_ref->create_server.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
341

Yes you are right .no create object in start-of-selection of the class then 'me' is unidentified because if class server inherits class client and u do create of for server automatically within the constructor method you can call the super contructor through in that case you don't have use create object for client .

But in this case where you have two different classes .

You have do a create object .

Please reward if useful.

2 REPLIES 2
Read only

Former Member
0 Likes
342

Yes you are right .no create object in start-of-selection of the class then 'me' is unidentified because if class server inherits class client and u do create of for server automatically within the constructor method you can call the super contructor through in that case you don't have use create object for client .

But in this case where you have two different classes .

You have do a create object .

Please reward if useful.

Read only

Chaitanyat
Participant
0 Likes
341

hi,

"me" is an implicit object/instance that comes into picture when ever a class is instantiated. This is used for self reference. If at all a class is not instantiated then "me" would not have any significance.

regards,

chaitanya.

Message was edited by:

Chaitanya