Tuesday, December 20, 2016

Classes


class SimpleDate {
    constructor(year, month, day) {
     
        this.dt = new Date(year, month, day);

        this._year = year;
        this._month = month;
        this._day = day;
    }

    addDays(nDays) {
        dt += nDays;
    }
    getDay() {
        return this._day;
    }
}
class ComplicatedDate extends SimpleDate {
    constructor(year, month, day,Hour, Minute) {
        debugger;
    super(year, month, day);
    this.dt.setHours(this.dt.getHours()+Hour);
    this.dt.setMinutes(this.dt.getMinutes()+Minute);

    }
}

c = new     ComplicatedDate(1977,12,19,2,45);

No comments:

Post a Comment