TypeScript Method Overriding

TypeScript Method Overriding

Method Overriding -
In Method Overriding, redefined the base class methods in the derive class or child class.

Example as,

class NewPrinter extends Printer {
    doPrint(): any {
        super.doPrint();
        console.log("Called Child class.");
    }

    doInkJetPrint(): any {
        console.log("Called doInkJetPrint().");
    }
}

let printer: new () => NewPrinter;
printer.doPrint();
printer.doInkJetPrint();

Stayed Informed – Learn Angular 2 with TypeScript


I hope you are enjoying with this post! Please share with you friends. Thank you!!
ANIL SINGH

Hey! I'm Anil Singh. I author this blog. I'm Active Blogger, Programmer. I love learning new technologies, programming, blogging and participating the forum discussions more...
My Blogs - http://www.code-sample.com and http://www.code-sample.xyz
My Books - Buy Books Online at Best Prices

You Might Also Like
Post a Comment
www.code-sample.com/. Powered by Blogger.