Inheritance III problem


#1
class HospitalEmployee {
  constructor(name) {
    this._name = name;
    this._remainingVacationDays = 20;
  }
  
  get name() {
    return this._name;
  }
  
  get remainingVacationDays() {
    return this._remainingVacationDays;
  }
  
  takeVacationDays(daysOff) {
    this._remainingVacationDays -= daysOff;
  }
}

class Nurse extends HospitalEmployee {
  constructor(name,remainingVacationDays,certifications) {
  super(name,remainingVacationDays)
  this._name = name;
	this._remainingVacationDays = 20;
  this._certifications = certifications;

  function.takeVacationDays();
  function.addCertification(); 
  }
}

Having a problem figuring out why code won’t pass. Also I don’t fully understand the ‘super’ part either.


#2

super() lets us pass constructor parameters up to the parent, or super class the derived class inherits from. We would not pass more arguments that there are parameters for, though, so only pass name, and nothing else. remainingVacationDays is initialized in the parent class and inherited by the subclass.

The variable remainingVacationDays should not be a constructor parameter of Nurse. As mentioned, it gets inherited.

If still confused or having trouble passing, please post the URL to the lesson page so we can test your (new) code.