我定义了一个抽象类
继承非抽象类,
且不包含抽象方法
但是运行 OK
这样做有啥负面作用?
public abstract class ExceptionBase extends Exception {
protected int status;
protected int code;
public ExceptionBase(String msg){
super(msg);
}
public ExceptionBase(int status, int code, String msg){
super(msg);
this.status = status;
this.code = code;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String toString(){
return String.format("%s [status=%i, code=%d, message=%s]", this.getClass().getSimpleName(), status, code, getMessage());
}
}