![](https://box.kancloud.cn/dbabc2008fa15e3a2f7f23fb6187bf8f_687x378.png)
```
~~~
class People {
constructor(name,house) {
this.name = name;
this.house= house
}
saySomething() {
}
}
class A extends People {
constructor(name,house) {
super(name,house)
}
saySomething() {
alert('I am A')
}
}
class B extends People {
constructor(name,house) {
super(name,house)
}
saySomething() {
alert('I am B')
}
}
class House{
constructor(city){
this.city = city;
}
showCity(){
alert('this city is ' + this.city)
}
}
let aHouse = new House('北京');
let a = new A('a',aHouse )
console.log(a);
let b = new B('b')
console.log(b)
~~~
```