Skip to main content

All Questions

Filter by
Sorted by
Tagged with
3 votes
3 answers
519 views

What's a good example of a static factory method returning instances of subclasses?

One benefit of having a class provide a static factory method rather than public constructors is the method can return an instance of a subclass. For example, if the class ...
Ellen Spertus's user avatar