JAVA设计模式之工厂模式(3种完整免费提供)

loading 分享 2026-7-16 下载文档

}

public int getWaistSize() { }

return waistSize;

//抽象工厂 ClothesFactory.java

public abstract class ClothesFactory { }

//具体工厂

BeijingClothesFactory.java

public class BeijingClothesFactory extends ClothesFactory { }

ShanghaiClothesFactory.java

public class ShanghaiClothesFactory extends ClothesFactory {

public Trousers createTrousers(int waistSize, int height) { }

public UpperClothes createUpperClothes(int chestSize, int height) { }

return new WesternUpperClothes(\北京牌上衣\return new WesternTrousers(\北京牌裤子\public abstract UpperClothes createUpperClothes(int chestSize,int height); public abstract Trousers createTrousers(int waistSize,int height);

}

public Trousers createTrousers(int waistSize, int height) { }

public UpperClothes createUpperClothes(int chestSize, int height) { }

return new WesternUpperClothes(\上海牌上衣\return new WesternTrousers(\上海牌裤子\


JAVA设计模式之工厂模式(3种完整免费提供).doc 将本文的Word文档下载到电脑
搜索更多关于: JAVA设计模式之工厂模式(3种完整免费提供) 的文档
相关推荐
相关阅读