Answer the question
In order to leave comments, you need to log in
Why newInstance instead of a constructor?
In books I met such an approach, instead of a constructor, a static method is used that returns an instance of the class.
class Class1 {
public static Class1 newInstance() {
return new Class1();
}
}
Answer the question
In order to leave comments, you need to log in
In your example, you have a defective singleton
Pattern Book - Gang of Four
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question