Guest User

Untitled

a guest
Dec 15th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. interface WheelFactory {
  2.  
  3. Wheel makeWheel();
  4. WheelFittingExpert makeFittingExpert();
  5. }
  6.  
  7. // Car Wheel factory to return car wheel and car expert
  8. class CarWheelFactory implements WheelFactory {
  9.  
  10. public Wheel makeWheel() {
  11.  
  12. return new CarWheel();
  13. }
  14.  
  15. public WheelFittingExpert makeFittingExpert() {
  16.  
  17. return new CarExpert();
  18. }
  19. }
  20.  
  21. // Bike Wheel factory to return bike wheel and bike expert
  22. class BikeWheelFactory implements WheelFactory {
  23.  
  24. public Wheel makeWheel() {
  25.  
  26. return new BikeWheel();
  27. }
  28.  
  29. public WheelFittingExpert makeFittingExpert() {
  30.  
  31. return new BikeExpert();
  32. }
  33. }
Add Comment
Please, Sign In to add comment