0

What is difference b/w a singelton class and a static class?

From what i know singelton class only have one instance and static class also can have only one object if all methods and variables are static. So, is there any particular diff b/w both?

12th Jul 2018, 9:47 AM
Dhruv garg
Dhruv garg - avatar
2 Réponses
+ 3
Singleton is a pattern and not a keyword. ... A Singleton can implement interfaces, inherit from other classes and allow inheritance. While a static class cannot inherit their instance members. So Singleton is more flexible than static classes and can maintain state.
12th Jul 2018, 10:36 AM
SauRav Pawar
SauRav Pawar - avatar
0
Thanks for the explanation. ☺️☺️ can you please explain line singelton is pattern.
12th Jul 2018, 3:22 PM
Dhruv garg
Dhruv garg - avatar