1) I have an instance of an object (declared and assigned in an package variable) A global object (type).
2) I want to have a function that returns a pointer to that object (with a NOCOPY). A function named let say getInstance(). --> if the object already is instanciate, the reference will be given, if not, a new object will be created.
(like the singleton pattern)
3) I want to create a procedure where I will have something like:
PROCEDURE doSomething (
context IN globalObject%Type DEFAULT globalObject.getInstance()
The idea is if I don't pass the context as param to my doSomething procedure the procedure globalObject.getInstance() will initialize the context variable.
I should like that the globalObject.getInstance() returns an NOCOPY object.