Skip to content

Instantly share code, notes, and snippets.

@MartinsAlexandre
Created March 12, 2018 17:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartinsAlexandre/64c5b3467aea0a23b19de1ffbff781a9 to your computer and use it in GitHub Desktop.
Save MartinsAlexandre/64c5b3467aea0a23b19de1ffbff781a9 to your computer and use it in GitHub Desktop.
TypeScript part2
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