Interface in Typescript Example !

 export interface emp{

    fname:string;
    lname:string;
    display();
}

-----------------------------------------------------------------------------------------


import { emp } from "./interface";

export class employee implements emp{
    fname: string;
    lname: string;
    salary:number;

    constructor(f:string,l:string,sal:number){
        this.fname=f;
        this.lname=l;
        this.salary=sal;
    }

    display() {
        console.log(`
       
        ---------------Employee Details-------------------------
                    First Name::${this.fname}
                     Last Name::${this.lname}
                        salary::${this.salary}
        `)
    }

}

Comments

Popular posts from this blog

Primary/Main features of Java

HTTrack ऑफलाइन वेबसाइट डाउनलोडर क्या है ?

Which language is used for Java?