Singleton Class With Protected Constructor
Class was designed with Protected Constructor as a SingleTon Class. It is shipped to Customer. Now need to submit a patch such that thi开发者_JAVA技巧s Protected constructor can be made as a Private.
is it possible?
I am guessing by your user name that your language is java...
A singleton must have a private constructor to be safe - otherwise it's not guaranteed to be a singleton!
You should just make it private. If your customer has subclassed your singleton and used the protected constructor, too bad. You shouldn't break your application design just to provide support for poisoned legacy code.
精彩评论