Difference Between Singleton and Static class?

Singleton:
 1. Singleton class contains both static and non-static members
 2. You can create instance of Singleton class.
 3. You can implement inheritance.
 4. You can clone a singleton class object.
 5. Singleton class object creates in Heap memory.

 Static Class: 
  1. Static class contains only static members.
  2. You can't create instance of Static class.
  3. Once you declare a class as static you can't implement inheritance.
  4. You can't clone static class object.

  5. Static class object creates in stack memory.

Comments

Popular posts from this blog

Explain what is routing in MVC? What are the three segments for routing important?

What is the difference between “HTML.TextBox” vs “HTML.TextBoxFor”?

Explain what is the difference between View and Partial View?