What is named factory and default constructors?

A named constructor can only generate the instance of the current class. A factory constructor can decide which instance to return on runtime, it can return either the instance of the current class or any of the instances of its descendants class.

Leave a Reply

Your email address will not be published. Required fields are marked *

What is named factory and default constructors?

A named constructor can only generate the instance of the current class. A factory constructor can decide which instance to return on runtime, it can return either the instance of the current class or any of the instances of its descendants class.

Leave a Reply

Your email address will not be published. Required fields are marked *