Created
March 12, 2018 17:05
-
-
Save MartinsAlexandre/64c5b3467aea0a23b19de1ffbff781a9 to your computer and use it in GitHub Desktop.
TypeScript part2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Animal { | |
} | |
class Chat extends Animal { | |
quatreP: boolean; | |
} | |
class Chien extends Animal { | |
quatreP: boolean; | |
} | |
class Oiseaux extends Animal { | |
} | |
class Poisson extends Animal { | |
} | |
class Insect extends Animal { | |
} | |
interface Noir { | |
noir: boolean; | |
} | |
interface quatreP { | |
quatreP: boolean; | |
} | |
function nourrir(Animal: Noir){ | |
console.log("j'ai faim"); | |
} | |
function quatreP(Animal: quatreP){ | |
console.log("j'ai 4 pattes"); | |
} | |
function miauler(chat: Chat) { | |
console.log("MMiiiaaaaoouuu"); | |
} | |
function caresse(mammifere: quatreP) { | |
console.log("RonnRonnn"); | |
} | |
function photo(animal: Animal) { | |
console.log("Dites : Cheeseeeeeeeeee"); | |
} | |
function voler(oiseaux: Oiseaux){ | |
console.log("I Believe I Can Fly"); | |
} | |
function Nager (poisson: Poisson) { | |
console.log("Ploufff"); | |
} | |
class Europeen extends Chat{ | |
noir: boolean; | |
} | |
class Chartreux extends Chat{ | |
} | |
class TerreNeuve extends Chien{ | |
noir: boolean; | |
} | |
class MoonMoon extends Chien{ | |
} | |
class Mesange extends Oiseaux { | |
} | |
class Merle extends Oiseaux { | |
noir: boolean; | |
} | |
class Requin extends Poisson { | |
} | |
class Thon extends Poisson { | |
} | |
class Asticot extends Insect { | |
} | |
photo(new Chartreux); | |
nourrir(new Europeen); | |
nourrir(new TerreNeuve); | |
Nager(new Poisson); | |
voler(new Merle); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment