I have been reading on the net searching for what others alternatives do i have besides singleton and i came across the following site:-
There is a paragraph stating:-
To accomplish this(singleton effect), create the class as a normal, non-singleton, class and enforce the single-instance only behaviour elsewhere in the application. If you want a global point of access (the problems with globals described above will still occur), then you could use a factory to create the instance and reuse it in any code that requests it. If you don’t want the global point of access then you could create a single instance and pass it as an argument to all the classes and methods that need it.
I don't quite understand how to do it. Can someone further explain the paragraph? Coding examples would be appreciated.
Thanks in advance!