// inheritance = allows a new class to inherit properties and methods // from an existing class (parent -> child) // helps with code reusability class Animal{ alive = true; eat(){ console.log(`This ${this.name} is eating`); } sleep(){ console.log(`This ${this.name} is sleeping`); } } class Rabbit extends Animal{ name = "rabbit"; run(){ console.log(`This ${this.name} is running`); } } class Fish extends Animal{ name = "fish"; swim(){ console.log(`This ${this.name} is swimming`); } } class Hawk extends Animal{
name = "hawk"; fly(){ console.log(`This ${this.name} is flying`); } } const rabbit = new Rabbit(); const fish = new Fish(); const hawk = new Hawk(); console.log(rabbit.alive); rabbit.eat(); rabbit.sleep(); rabbit.run();
I'm wondering if dev tools have validation features for code inconsistencies like calling a method that doesn't exist or trying to use an unexisting variable/attribute (is there a vscode extension for this?). in Java for example those are detected in compile time, i.e. you need to fix them to get to run the code (the IDE also warns about them to help save time)
// inheritance = allows a new class to inherit properties and methods
// from an existing class (parent -> child)
// helps with code reusability
class Animal{
alive = true;
eat(){
console.log(`This ${this.name} is eating`);
}
sleep(){
console.log(`This ${this.name} is sleeping`);
}
}
class Rabbit extends Animal{
name = "rabbit";
run(){
console.log(`This ${this.name} is running`);
}
}
class Fish extends Animal{
name = "fish";
swim(){
console.log(`This ${this.name} is swimming`);
}
}
class Hawk extends Animal{
name = "hawk";
fly(){
console.log(`This ${this.name} is flying`);
}
}
const rabbit = new Rabbit();
const fish = new Fish();
const hawk = new Hawk();
console.log(rabbit.alive);
rabbit.eat();
rabbit.sleep();
rabbit.run();
Yo bro seriously how do you manage to be such a goat like lord I fricking love your tutorials you make everything look so easy
True ! god bless
Don't have time to watch as I'm heading out but had to instalike,
Keep at it bro.
This is my seal. I have watched the entire video, understood it, and I can explain it in my own words, thus I have gained knowledge. This is my seal.
Excellent tutorial. Thanks for sharing
Bro bro bro u a legend ❤❤❤❤❤❤❤
❤ waiting for more videos Bro(fourth day)
Amazing job man!
Nice explanation. However, I wonder why you didn't use constructor in any of the classes. Will anything get changed with constructors in inheritance?
Thank you
really a true bro code
excellent explanation
"They're eating the dogs. They're eating the cats"
hawk tuah
I'm wondering if dev tools have validation features for code inconsistencies like calling a method that doesn't exist or trying to use an unexisting variable/attribute (is there a vscode extension for this?). in Java for example those are detected in compile time, i.e. you need to fix them to get to run the code (the IDE also warns about them to help save time)
bro, can you make a video on hashmaps
Very much good 😂!
We want react js tutorials
👇
thanks bro 😂
Bro make a tutorial to download the Java for full stack developer in laptop
Asking for sis
bro please teach us typeScript
I'm learning JS, and thought you needed to use constructors within classes to define properties, am I missing something?
bro code >