Introduction
Today, in this article let's play around with one of the interesting and most useful concepts in TypeScript.
Question: What is inheritance in TypeScript?
In simple terms "It provides flexibility to perform inheritance using the TypeScript language".
Step 1: Create a new HTML with TypeScript project; see:

Step 2: The complete code of app.ts looks like this:
- class Addition {
- public Add(a: number, b: number): number {
- return a + b;
- }
- }
- class Substraction extends Addition {
- public Sub(a: number, b: number): number {
- return a - b;
- }
- }
- class Multiplication extends Substraction {
- public Mul(a: number, b: number): number {
- return a * b;
- }
- }
- class Division extends Multiplication {
- public Div(a: number, b: number): number {
- return a / b;
- }
- }
- var objDivision = new Division();
- alert("Addition Result is: " + objDivision.Add(10, 20));
- alert("Substraction Result is: " + objDivision.Sub(20, 10));
- alert("Multiplication Result is: " + objDivision.Mul(10, 20));
- alert("Division Result is: " + objDivision.Div(10, 20));



Mahesh ChandPosted Oct 17, 2012, 12:32 AM
I agree. Good part is it is object oriented and supports classes, methods, inheritance etc. I like where Microsoft is gong with it.
Aditya GoelPosted Oct 15, 2012, 11:04 PM
I want to what is type script.........
Gaurav GuptaPosted Oct 15, 2012, 10:54 PM
Nice Article, it is more flexible than JavaScript and easy to develop...