-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path5-building.js
33 lines (31 loc) · 887 Bytes
/
5-building.js
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
31
32
33
/**
* Represents a building with a specified square footage.
* @class
*/
export default class Building {
/**
* Creates an instance of Building.
* @param {number} sqft - The square footage of the building.
* @throws {Error} - Throws an error if a subclass does not implement evacuationWarningMessage.
*/
constructor(sqft) {
this._sqft = sqft;
if (this.constructor !== Building && this.evacuationWarningMessage === undefined) {
throw new Error('Class extending Building must override evacuationWarningMessage');
}
}
/**
* Retrieves the square footage of the building.
* @return {number} The current square footage.
*/
get sqft() {
return this._sqft;
}
/**
* Updates the square footage of the building.
* @param {number} newSqft - The new square footage to set.
*/
set sqft(newSqft) {
this._sqft = newSqft;
}
}