Singleton vs Static Class

  • Singleton Class instance can be passed as a parameter to a method whereas static class cannot
  • Singleton class can implement interface(s) or derive from another class whereas Static class can’t
  • Since singleton class supports interface implementation, we can reuse our singleton for any number of implementations of interface confirming objects
  • Your code will be more flexible if you are using a singleton class
  • A singleton class can have instance members while a static class cannot

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s