‎2009 Nov 20 11:36 AM
Hi all,
Any body please provide me information on singleton class and how can we created them in ABAP.
Thanks.
Anil.
‎2009 Nov 20 12:28 PM
A singleton class is a class that cannot be instantiated more than once (in a single program that is). Of course you can do the same in other programs without facing any problems. You can do this by setting the flag final and create the class as private. Now the class can only be instantiated in one of its own methods.
I can't really think of a real life example in which you want to make sure that a class is only instantiated once.
‎2009 Nov 20 12:39 PM
I have a real life example. If getting married is your objective (Class), better it gets instatiated only once. Else it could land you in a lot of trouble
‎2009 Nov 20 12:33 PM
Hi Anil,
is this an exam question? (looks like...)
[singleton class and how can we created them in ABAP|http://www.google.es/#hl=en&source=hp&q=singletonclassandhowcanwecreatedtheminABAP&btnG=GoogleSearch&aq=f&oq=singletonclassandhowcanwecreatedthemin+ABAP&fp=1&cad=b]
Regards,
Clemens
‎2009 Nov 20 3:25 PM
Hi,
See following blog. It has all details about singlton.
http://help-abap.blogspot.com/2008/09/abap-object-design-patterns-singleton.html
rgds,
PB