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;
相关推荐: