Created
January 31, 2021 16:36
-
-
Save Mahdhir/6775be1d9516b7cff5194f88bfce6a14 to your computer and use it in GitHub Desktop.
Revisions
-
Mahdhir created this gist
Jan 31, 2021 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,71 @@ interface IDuck{ walk():void; quack():void; } class Duck implements IDuck{ walk():void { console.log("Duck walk"); } quack():void { console.log("Duck quack"); } toString():String{ return "I am a duck who walks and quacks"; } } interface IPelican{ walk():void; quack():void; dive():void; } class Pelican implements IPelican{ walk():void { console.log("Pelican walk"); } quack():void { console.log("Pelican quack"); } dive():void { console.log("Pelican dive"); } toString():String{ return "I am a pelican who walks, quacks and dives"; } } class Platypus { walk():void { console.log("Platypus walk"); } growl():void { console.log("Platypus growl"); } toString():String{ return "I am a platypus who walks and growls"; } } function print(duck:IDuck){ console.log("Input is a duck\n" + duck.toString()); } let duck = new Duck(); let pelican = new Pelican(); let platypus = new Platypus(); print(duck); print(pelican); print(platypus);