An open API service indexing awesome lists of open source software.

https://github.com/therezacuet/factory-design-pattern

Factory Pattern defines an interface for creating an object, but let’s the classes that implement the interface decide which class to instantiate
https://github.com/therezacuet/factory-design-pattern

Last synced: 7 months ago
JSON representation

Factory Pattern defines an interface for creating an object, but let’s the classes that implement the interface decide which class to instantiate

Awesome Lists containing this project

README

          

# Factory-Design-Pattern
```
public interface Vehicle {
int set_num_of_wheels();
int set_num_of_passengers();
boolean has_gas();
}
```
a) Explain how can you use the pattern to create car and plane class?

Answer:

I have used Factory design to solve this problem.Factory Pattern defines an interface for creating an object, but let’s the classes that implement the interface decide which class to instantiate. The Factory method lets a class defer instantiation to subclasses.