CodesJava

Easy learning with example program codes

typescript interface multiple inheritance

TypeScript provides the facility to inherit multiple interfaces.

Syntax:

ChildInterfaceName extends SuperInterfaceName1, SuperInterfaceName2,…,SuperInterfaceNamen

Example:

interface IPerson { 
   age:number;
   name:string;
} 
 
interface IEmployee { 
   empId:string; 
} 
 
interface Engineer extends IPerson, IEmployee {}
 
var obj:Engineer = {name:"Asmita", age:32, empId:"EMP023"}; 
console.log("Name:  "+obj.name);
console.log("Age:  "+obj.age);
console.log("Emp Id:  "+obj.empId);


Please follow and like us:
error








Copyright © 2019 CodesJava DMCA.com Protection Status