Turkey and the Balkans TV Channels

News about 100+ TV channels

Difference between static class and singleton pattern

  • Singleton object stores in Heap but, static object stores in stack
  • We can clone the object of Singleton but, we can not clone the static class object
  • Unlike static classes, we can use singletons as parameters or objects.
  • we can implement interface with Singleton class but not with Static class.
  • Singleton class follow the OOP(object oriented principles) but not static class
  • Singleton class maintains state. It is thread safe.
  • we can dispose the objects of a singleton class but not of static class

The difference between the Singleton and Static is Singleton Class can have value when Class object instantiated between server and client, such a way if three client want to have a shared data between them Singleton can be used. Static are always just shared and have no instance but multiple references.

Add comment

  • Comment
  • Preview