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
- Host: GitHub
- URL: https://github.com/therezacuet/factory-design-pattern
- Owner: therezacuet
- Created: 2019-05-22T06:00:12.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-23T09:08:59.000Z (over 6 years ago)
- Last Synced: 2025-01-22T21:14:57.955Z (9 months ago)
- Language: Java
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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.