function Units(abbrev, full) {
    this.abbrev = abbrev;
    this.full = full;
    this.getAbbrev = getAbbrev;
    this.getFull = getFull;
}

function getAbbrev() { return this.abbrev; }
function getFull() { return this.full; }

// generator
function makeUnits(units) {
    if (units === "km") return kilometers;
    if (units === "mi") return miles;
}

// subclasses
Kilometers.prototype = new Units;
function Kilometers() {
    this.superclass = Units;
    this.superclass("km", "kilometers");
}

Miles.prototype = new Units;
function Miles() {
    this.superclass = Units;
    this.superclass("mi", "miles");
}
