-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain2.js
More file actions
42 lines (37 loc) · 897 Bytes
/
main2.js
File metadata and controls
42 lines (37 loc) · 897 Bytes
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
34
35
36
37
38
39
// Come up with with a parent class
// Extend that parent class into two children
// Use Encapsulation, Abstraction, Inheritance, and Polymorphism
class Homes{
constructor(location, sqft, stories, bedrooms){
this._location = location
this._sqft = sqft
this._stories = stories
this.bedrooms = bedrooms
}
getaddress(){
return this._location
}
}
address (){
console.log(`I live at ${this._address}`)
}
}
class MobileHome extends Homes{
constructor(lotSize, pieces){
this.lotSize = lotSize
this.pieces = pieces
}
sayLotSize(){
console.log(`I have ${this.lotSize}`)
}
}
class MILunit extends Homes{
constructor(location, unitSize, doors){
super(location)
this.unitSize = unitSize
this.doors = doors
}
sayunitSize(){
console.log(`I have ${this.unitSize}`)
}
}