Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8695

Re: Accessing the public attributes of singleton class in reports directly by object's reference

$
0
0

Hello Manish,

 

this is my source code of singleton class , please have a look

 

class ZSINGLETON definition

   public

   create private .

 

public section.

 

   data NUM1 type I value 23. "#EC NOTEXT .

 

 

   class-methods GET_INSTANCE_OF

     returning

       value(OBJ) type ref to ZSINGLETON .

protected section.

private section.

 

   class-data GREF_OBJ type ref to ZSINGLETON .

 

   methods CONSTRUCTOR .

ENDCLASS.

 

 

 

CLASS ZSINGLETON IMPLEMENTATION.

 

 

* <SIGNATURE>---------------------------------------------------------------------------------------+

* | Instance Private Method ZSINGLETON->CONSTRUCTOR

* +-------------------------------------------------------------------------------------------------+

* +--------------------------------------------------------------------------------------</SIGNATURE>

method CONSTRUCTOR.

endmethod.

 

 

* <SIGNATURE>---------------------------------------------------------------------------------------+

* | Static Public Method ZSINGLETON=>GET_INSTANCE_OF

* +-------------------------------------------------------------------------------------------------+

* | [<-()] OBJ                            TYPE REF TO ZSINGLETON

* +--------------------------------------------------------------------------------------</SIGNATURE>

METHOD get_instance_of.

 

   IF gref_obj IS NOT BOUND.

      CREATE OBJECT gref_obj.

      obj = gref_obj.

   ELSE.

      obj = gref_obj.

     ENDIF.

 

   ENDMETHOD.

ENDCLASS.




Viewing all articles
Browse latest Browse all 8695

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>