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.
Singleton Class:
you can create one instance of the object and reuse it. Singleton instance is created for the first time when the user requested. singleton class can have constructor.
Static Class:
You can not create the instance of static class. are loaded automatically by the .NET Framework common language runtime (CLR) when the program or namespace containing the class is loaded. Static Class class cannot have constructor.
No comments:
Post a Comment