Bloomberg LP Interview Question
Software Engineer / DevelopersHave a reference count decremented each time the object is released and delete the obj when it reaches 0
huh? a singleton is provides one and only one object for the entire lifetime of the application. So why do you need a reference count? If it deletes, it deletes that same pointer.
Or are you talking about how many times it has been accessed/used in the program so that if it was deleted, it will not cause a crash because other section of the source code base is still using/referencing it?
In Java, Create a static function that sets the object's reference to null.
- Karthik December 07, 2010