No compile error when overriding private method of base class.

Topics: General
Feb 18, 2013 at 6:13 PM
With the following code no error is generated when the base class "_init" method is overridden in the derived class.
class BaseClass {

    constructor () {
        this._init();
    }

    private _init() {
        alert("base init called");
    }
}

class DerivedClass extends BaseClass {

    constructor () {
        super();
    }

    private _init() {
        alert("derived init called");
    }
}

new DerivedClass();
From section 8.2.2 of the language specification I got the impression that this would not be allowed.
Both public and private members are inherited, but only public members can be overridden.
Coordinator
Feb 18, 2013 at 11:34 PM
This looks like a bug. Moving over to the issue tracker.
Coordinator
Feb 18, 2013 at 11:35 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.