class Vehicle{
constructor(name){
this.name=name;
}
showName(){
console.log("我的名字是:"+this.name);
}
}
class Car extends Vehicle{
constructor(name,color){
super(name)
this.color=color;
}
showColor(){
console.log("我的颜色是:"+this.color);
}
}
var v=new Vehicle('卡车');
var c=new Car('奔驰','黑色');
v.showName();
c.showName();
c.showColor();