<>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,
QT Delete directory and file Java aggregate ------LinkedHashMap Underlying principle I've been drinking soft water for three years ? What is the use of soft water and water softener Java Xiao Ming A+B About wechat payment body( Product description ) Problems encountered Digital rolling lottery program 3 species Python data structure ,13 Creation methods , This is the conclusion , Great ! Huawei Mate 40 Pro+ 5G exposure : Leica film lens , Ceramic body What's the difference in server prices ? Operators Website visitors' mobile phone number capture