blob: eadf09ca9295ba9e9857b6943826526455516532 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
const { Employee } = require("./employee");
class Boss extends Employee {
constructor(name, accreditationLevel) {
super(name);
this.accreditationLevel = accreditationLevel;
}
getAccreditation() {
return this.accreditationLevel;
}
fire(target) {
if (!(target instanceof Employee)) {
console.log("I cannot fire that!");
return false;
} else if (
!(target instanceof Boss) ||
target.getAccreditation() < this.accreditationLevel
) {
console.log(target.getName() + " you are fired!");
return true;
} else {
console.log("I cannot fire someone superior to me!");
return false;
}
}
}
module.exports = {
Boss,
};
|