<!DOCTYPE html>
<html>
<body>
<h1>JavaScript クラスの継承</h1>
<p>別のクラスからすべてのメソッドを継承するには、「extends」キーワードを使用します。</p>
<p>「スーパー」メソッドを使用して、親のコンストラクター関数を呼び出します。</p>
<p id="demo"></p>
<script>
class Car {
constructor(brand) {
this.carname = brand;
}
present() {
return 'I have a ' + this.carname;
}
}
class Model extends Car {
constructor(brand, mod) {
super(brand);
this.model = mod;
}
show() {