類別在繼承時使用extends,而實現介面使用的是implemants
interface JLog {
    log():void
    desc:string
}
class ClassA implements JLog {    //ClassA對JLog介面進行實現
    desc:string
    name:string
    constructor(des: string){
        this.desc = des;
        this.name = 'ClassA 類別'
    }
    log(){
        console.log(this.name + this.desc)
    }
}
class ClassB implements JLog{    //ClassB對JLog介面進行實現
    desc:string
    name:string
    constructor(des: string){
        this.desc = des;
        this.name = 'ClassB 類別'
    }
    log(){
        console.log(this.name + this.desc)
    }
}
var clsa:JLog = new ClassA('AAAA');
var clsb:JLog = new ClassB('BBBB');
clsa.log();
clsb.log();
interface Shape{
    area(): number
}
interface ColorInterface {
    color:string
}
interface CircleInterface extends Shape, ColorInterface {
    radius:number
}
var circleImp:CircleInterface = {
    radius:2,
    color:'red',
    area():number {
        return this.radius * this.radius * 3.14;
    }
}
今天的介紹就到這邊告一個段落了,明天要介紹的內容是類型推斷與高級類型!