class Animal{
constructor(name, size) {
this.name = name;
this.size = size;
}
hello() {
console.log(this.name);
}
}
class Animal{
constructor(name, size) {
this.name = name;
this.size = size;
}
hello() {
console.log(this.name);
}
}
class Bird extends Animal{
constructor(name, size, speed) {
//super: konstruktor klasy bazowej
super(name, size);
this.speed = speed;
}
//override - nadpisanie metody
hello() {
console.log("i am a bird");
}
}
//wywołanie
var a = new Bird("sikorka", 99, 100);
a.hello();