/typescript/

TypeScript part 27 (interface inheritance)

2017-03-05 13:04:09

TypeScript

interface Animal {
    species: string
}

interface Dog extends Animal{
    breed: string
}

class BestFrend implements Dog {
    breed: string;
    species: string;

    constructor(breed: string, species: string) {
        this.breed = breed;
        this.species = species;
    }
}

let myDog = new BestFrend("Malamute", "Dog");

console.log(myDog);

JavaScript

var BestFrend = (function () {
    function BestFrend(breed, species) {
        this.breed = breed;
        this.species = species;
    }
    return BestFrend;
}());
var myDog = new BestFrend("Malamute", "Dog");
console.log(myDog);