mirror of
https://github.com/swc-project/swc.git
synced 2024-12-25 22:56:11 +03:00
20 lines
292 B
JavaScript
20 lines
292 B
JavaScript
|
class Animal {
|
||
|
constructor(name) {
|
||
|
this.name = name;
|
||
|
}
|
||
|
|
||
|
speak() {
|
||
|
console.log(`${this.name} makes a noise.`);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class Dog extends Animal {
|
||
|
constructor(name) {
|
||
|
super(name);
|
||
|
}
|
||
|
|
||
|
speak() {
|
||
|
console.log(`${this.name} barks.`);
|
||
|
}
|
||
|
}
|