public class Product {//商品基类
public String PName;
public double price;
public String PID;
public BufferedImage img;
public Product(String pName, double price, String pID, BufferedImage img) {
super();
PName = pName;
this.price = price;
PID = pID;
this.img = img;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((PID == null) ? 0 : PID.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Product other = (Product) obj;
if (PID == null) {
if (other.PID != null)
return false;
} else if (!PID.equals(other.PID))
return false;
return true;
}
}
KFC-
最新推荐文章于 2021-07-31 16:13:23 发布