#44 SingleTon Pattern ?

1.It is essential when you need only one instance of a class.

2.The Class itself is responsible for maintaining only one instance of class(Breaks Single Responsibility).

3.They make the System Tightly Coupled.

Implementation:

1.Non-Thread Safe

2.Thread Safe-Single Lock

3.Thread Safe -Double Check Lock

4.Thread Safe-Lazy Loading.

Source Code:

Source Code of SingleTon

Leave a comment