difference between static and singleton class

11 votes
Anonymous User asked 13-Nov-2017 in programming by Anonymous User

difference between static and singleton class.

1 Answer

0 votes
Arti Mishra answered 08-Aug-2018 by Arti Mishra

Difference between static class and Singleton class

Static Class:

1. You can’t create the instance (object) of static class. And it is directly accessible by using  the class name.
2. Static class, loaded automatically by the .NET Framework.
3. Static Class can’t contain any type of constructor.
4. You cannot pass the static class to a method.
5. It can’t be inherited by another Static class.

Singleton Class
1. In Singleton class, you can create the instance of the class and reuse it.
2. When user request, then an instance of singleton class is created.
3. Singleton class can contain different type of constructor.
4. You can create the object of singleton class and pass it to a method.
5. The singleton class follows the all concept of Inheritance.

Anonymous User commented 18-Feb-2019 by Anonymous User
Thank You for the answer.