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
Post a Comment