<>TypeScript Polymorphism in
// polymorphic : The parent class defines a method that is not implemented , Let the subclass inherit it to implement Each subclass has different performance // Polymorphism belongs to inheritance class Animal { name: string
= 'm'; constructor(name: string) { } eat() { console.log(` This is the way to eat `); } } class
Dog extends Animal { constructor(name: string) { super(name); } eat() {
console.log(`${this.name} I like meat `) } } let dog = new Dog(' puppy '); dog.eat();
// Dogs like meat class Cat extends Animal { constructor(name: string) { super(name); }
eat() { console.log(`${this.name} Like to eat mice `) } } let cat = new Cat(' kitten ') cat.eat()
// Kittens like to eat fish
Thanks for watching !!! If there is any deficiency , Please advise me

Technology
©2019-2020 Toolsou All rights reserved,
Final review of database : Summary of comprehensive application questions Laplance operator ( Second derivative ) Simple learning of computer composition principle pyqt Button call python program _PyQt: Link button to function in program How much can you go up once you change jobs ? Today, I saw the ceiling of job hopping python in str Function usage _python in str Usage Summary of built-in functions MySQL trigger web The server nginx---linux Installation and deployment C++ Chapter V polymorphism exercises :( It's coming to an end )python Check built-in functions , How to check python Built in function