On 01/04/2015 02:48 AM, Peter Firmstone wrote:
class B extends A {

    public final int cur;

    private static ReadSerial check(ReadSerial rs) {
        A a = new A(rs);

What to do if A is abstract?

Regards, Peter

int cur = rs.getInt("cur");
        if ( a.lower>  cur || cur>  a.upper )
             throw new IllegalArgumentException(
                 "cur outside lower and upper bounds");
        return rs;
    }

    public B(ReadSerial rs) {
        super(check(rs));
        cur = rs.getInt("cur");
    }
}

Reply via email to