Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface WheelFactory {
- Wheel makeWheel();
- WheelFittingExpert makeFittingExpert();
- }
- // Car Wheel factory to return car wheel and car expert
- class CarWheelFactory implements WheelFactory {
- public Wheel makeWheel() {
- return new CarWheel();
- }
- public WheelFittingExpert makeFittingExpert() {
- return new CarExpert();
- }
- }
- // Bike Wheel factory to return bike wheel and bike expert
- class BikeWheelFactory implements WheelFactory {
- public Wheel makeWheel() {
- return new BikeWheel();
- }
- public WheelFittingExpert makeFittingExpert() {
- return new BikeExpert();
- }
- }
Add Comment
Please, Sign In to add comment