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

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

public abstract class UpperClothes { }

Trousers.java

public abstract class Trousers { }

//具体产品

WesternUpperClothes.java

public class WesternUpperClothes extends UpperClothes {

private int chestSize; private int height; private String name;

WesternUpperClothes(String name,int chestSize,int height){ }

this.name=name; this.chestSize=chestSize; this.height=height; public abstract int getWaistSize(); public abstract int getHeight(); public abstract String getName(); public abstract int getChestSize(); public abstract int getHeight(); public abstract String getName();

}

public int getChestSize() { }

public int getHeight() { }

public String getName() { }

return name; return height; return chestSize;

CowboyUpperClothes.java

public class CowboyUpperClothes extends UpperClothes {

private int chestSize; private int height; private String name;

CowboyUpperClothes(String name,int chestSize,int height){ }

public int getChestSize() {

return chestSize; this.name=name; this.chestSize=chestSize; this.height=height;

}

}

public int getHeight() { }

public String getName () { }

return name; return height;

WesternTrousers.java

public class WesternTrousers extends Trousers {

private int waistSize; private int height; private String name;

WesternTrousers(String name,int waistSize,int height){ }

public int getHeight() { }

public String getName() {

return height; this.name=name; this.waistSize=waistSize; this.height=height;

}

}

return name;

public int getWaistSize() { }

return waistSize;

CowboyTrousers.java

public class CowboyTrousers extends Trousers {

private int waistSize; private int height; private String name;

CowboyTrousers(String name,int waistSize,int height){ }

public int getHeight() { }

public String getName() { }

return name; return height; this.name=name; this.waistSize=waistSize; this.height=height;


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