🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
![](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) ~~~ ```