Nguyễn Pháp
New member
Why can’t we use static class instead of Singleton?
Answer
Static class will have all its member as static only unlike Singleton. It can be lazily loaded whereas static will be initialized whenever it is first loaded. Singleton object stores in Heap but, static object stores in stack. We can clone the object of Singleton but, we can not clone the static class object.
Answer
Static class will have all its member as static only unlike Singleton. It can be lazily loaded whereas static will be initialized whenever it is first loaded. Singleton object stores in Heap but, static object stores in stack. We can clone the object of Singleton but, we can not clone the static class object.