is that possible to extends the class without writing the current class name?
example, I have class Animal
like this
class Animal {
constructor(foot, livein) {
this.foot = foot;
this.livein = livein;
}
}
I want to extends that class Animal with many kinds of Animals, I am sure I should create a lot of Animals name classes,
like class Bear extends Animal (){},
class Cat extends Animal (){},
class Pig extends Animal(){}
and how about if we have 100 kinds of animals ? should we write one by one for that name? and is that possible if we don't do that?
I want to shorthand them like this without creat many kinds of classes,
let pig = new Pig(4, 'woods') // Pig {foot: 4, livein: 'woods'}
let cat = new Cat(4, 'around us') // Cat {foot: 4, livein: 'around us'}
that pig and cat output because extends from Animal class
is that possible to write many kinds of extends from Animal without creating them but create them on a variable ??
I hope my question makes sense :D