in Design Patterns by
Q:
Why use a factory class to instantiate a class when we can use new operator?

1 Answer

0 votes
by
Factory classes provide flexibility in terms of design. Below are some of the benefits of factory class:

•Factory design pattern results in more decoupled code as it allows us to hide creational logic from dependant code

•It allows us to introduce an Inversion of Control container

•It gives you a lot more flexibility when it comes time to change the application as our creational logic is hidden from dependant code
Click here to read more about Loan/Mortgage
Click here to read more about Insurance

Related questions

0 votes
asked Oct 18, 2019 in C Sharp by Robin
0 votes
asked Jan 30 in React JS by rajeshsharma
0 votes
asked Jul 2, 2019 in React JS by Venkatshastri
0 votes
asked Oct 16, 2019 in Design Patterns by DavidAnderson
0 votes
asked May 4, 2020 in Cloud Computing by GeorgeBell
...