3 ms·
How would you return the error from the private constructor to the static factory method?
by rumcajz 13y ago
How would you return the error from the private constructor to the static factory method?
- dragontamer 13y agoThrough any means necessary. Exceptions, partially initialized objects, whatever. But since it is entirely contained within the class now, external code doesn't have to deal with the ugly crap that is inside of the class. IE: A perfect separation of concerns. Adding new exceptions to the constructor isn't a problem, because it is a private constructor... only "friends" can access it. There are a _very limited_ number of functions that can use the constructor.