<script>
class Father{
constructor(x,y){
this.x = 5;
this.y = 10;
console.log(this)
}
sum(){
alert(this.x+this.y + this.z)
}
}
class Son extends Father{
constructor(x,y,z){
super(x,y);
this.z = z
console.log(this)
}
}
var son = new Son(1,2,3);
son.sum();
</script>
|
|