How to create a single instance of class
How to make single instance of class and how to use in all the modules
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Vinay SinghRank #604 · 4K reputationPosted Jun 30, 2016, 2:39 AM EDT
ketan borsdiyaRank #2,258 · 624 reputationPosted Jun 30, 2016, 2:51 AM EDT
Vinay SinghRank #604 · 4K reputationPosted Jun 30, 2016, 2:56 AM EDT
Static Class:
Singleton:
- 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.
- You can create the object of singleton class and pass it to method.
- Singleton class does not say any restriction of Inheritance.
- We can dispose the objects of a singleton class but not of static class.
For detail check the linkketan borsdiyaRank #2,258 · 624 reputationPosted Jun 30, 2016, 3:00 AM EDT
Rafnas T PRank #280 · 8.8K reputationPosted Jun 30, 2016, 3:02 AM EDT
Vinay SinghRank #604 · 4K reputationPosted Jun 30, 2016, 3:04 AM EDT
Vinay SinghRank #604 · 4K reputationPosted Jun 30, 2016, 3:11 AM EDT
ketan borsdiyaRank #2,258 · 624 reputationPosted Jun 30, 2016, 3:22 AM EDT
ketan borsdiyaRank #2,258 · 624 reputationPosted Jun 30, 2016, 3:34 AM EDT
Vinay SinghRank #604 · 4K reputationPosted Jun 30, 2016, 3:35 AM EDT
Mageshwaran RRank #411 · 6.1K reputationPosted Nov 24, 2019, 6:12 AM EST