interface IBase { id : number ; } interface IDerivedFromBase extends IBase { name : string ; } class IdNameClass implements IDerivedFromBase { id : number = 0 ; name : string = "nameString" ; } interface IBaseStringOrNumber { id : string | number ; } interface IDerivedFromBaseNumber extends IBaseStringOrNumber { id : number ; } interface IMultiple extends IDerivedFromBase , IDerivedFromBaseNumber { description : string ; } let multipleObject = { id : 1 , name : "myName" , description : "myDescription" } ; class BaseClass implements IBase { id : number = 0 ; } class DerivedFromBaseClass extends BaseClass implements IDerivedFromBase { name : string = "nameString" ; } interface IFirstInterface { id : number ; } interface ISecondInterface { name : string ; } class MultipleInterfaces implements IFirstInterface , ISecondInterface { id : number = 0 ; name : string = "nameString" ; } class BaseClassWithCtor { private id : number ; constructor ( id ) { this . id = id ; } } class DerivedClassWithCtor extends BaseClassWithCtor { private name : string ; constructor ( id , name ) { super ( id ) ; this . name = name ; } } let derivedClassInstance = new DerivedClassWithCtor ( 1 , "test" ) ; class BaseClassWithFn { print ( text ) { console . log ( `BaseClassWithFn.print() : ${ text }` ) ; } } class DerivedClassFnOverride extends BaseClassWithFn { print ( text ) { console . log ( `DerivedClassFnOverride.print(${ text })` ) ; } } let derivedClassFnOverride = new DerivedClassFnOverride ( ) ; derivedClassFnOverride . print ( "test" ) ; class DerivedClassFnCallthrough extends BaseClassWithFn { print ( text ) { super . print ( `from DerivedClassFncallthrough : ${ text }` ) ; } } let derivedCallthrough = new DerivedClassFnCallthrough ( ) ; derivedCallthrough . print ( "text" ) ; class BaseClassProtected { protected id : number ; private name : string = "" ; constructor ( id ) { this . id = id ; } } class AccessProtected extends BaseClassProtected { constructor ( id ) { super ( id ) ; console . log ( `base.id = ${ this . id }` ) ; } } let accessProtected = new AccessProtected ( 1 ) ; abstract class EmployeeBase { public id : number ; public name : string ; abstract doWork ( ) ; constructor ( id , name ) { this . id = id ; this . name = name ; } } class OfficeWorker extends EmployeeBase { doWork ( ) { console . log ( `${ this . name } : doing work` ) ; } } class OfficeManager extends OfficeWorker { public employees : OfficeWorker [ ] = [ ] ; manageEmployees ( ) { super . doWork ( ) ; for ( let employee of this . employees ) { employee . doWork ( ) ; } } } let joeBlogg = new OfficeWorker ( 1 , "Joe" ) ; let jillBlogg = new OfficeWorker ( 2 , "Jill" ) ; let jackManager = new OfficeManager ( 3 , "Jack" ) ; jackManager . employees . push ( joeBlogg ) ; jackManager . employees . push ( jillBlogg ) ; jackManager . manageEmployees ( ) ; class A { } class BfromA extends A { } class CfromA extends A { } class DfromC extends CfromA { } console . log ( `A instance of A : 
    ${ new A ( ) instanceof A }` ) ; console . log ( `BfromA instance of A : 
    ${ new BfromA ( ) instanceof A }` ) ; console . log ( `BfromA instance of BfromA : 
    ${ new BfromA ( ) instanceof BfromA }` ) ; console . log ( `CfromA instance of BfromA : 
    ${ new CfromA ( ) instanceof BfromA }` ) ; console . log ( `DfromC instance of CfromA : 
    ${ new DfromC ( ) instanceof CfromA }` ) ; console . log ( `DfromC instance of A : 
    ${ new DfromC ( ) instanceof A }` ) ;