This project shows usage of factory method pattern.
The main principle is: "Depend on abstractions. Do not depend on concrete classes."
In factory method pattern we rely on inheritance.
Object creation is delegated to subclasses which implement the factory method to create objects.
We define an interface for creating one product.
Project is created with:
- Java
IDE: Intellij IDEA 2018
To run this project, you need to have jdk
and jre
installed.
Download the src
folder and open it in a command prompt
or terminal
.
Type javac PizzaDrive.java
and press enter to compile.
Type java PizzaDrive
to run program.
This project was created as an exercise from Eric Freeman, Elisabeth Freeman, Bert Bates and Kathy Sierra book "Head First. Wzorce projektowe".