hello
I want to know to how to make class singleton but donot make constructor private and method static.
means want to something which is not possible to clone. Something like that
Thanks
Regards
Rahul
bhallarahul
-4
Light Poster
Recommended Answers
Jump to Postand ... why not make the constructor private? if the constructor is not private, what's to stop us from creating multiple instances?
Jump to Postsomjit: IMHO the second example isn't a good one, since that Singleton won't be a Singleton.
1. every single class within that same package can create an unlimited amount of instances of that class.
2. every child class can create an unlimited number of instances of that class
3. through …
All 8 Replies
somjit{}
60
Junior Poster in Training
Featured Poster
stultuske
1,116
Posting Maven
Featured Poster
somjit{}
commented:
spot on!
+3
stultuske
1,116
Posting Maven
Featured Poster
somjit{}
60
Junior Poster in Training
Featured Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
bhallarahul
-4
Light Poster
jwenting
1,889
duckman
Team Colleague
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.