Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. abstract class Animaux{
  2. color: string;
  3. nbPattes: number;
  4. constructor(color: string, nbPattes: number){
  5. this.color = color;
  6. this.nbPattes = nbPattes;
  7. }
  8. }
  9. class Animaux4P extends Animaux{
  10. constructor(color: string){
  11. super(color, 4)
  12. }
  13. }
  14. class AnimauxNoir extends Animaux{
  15. constructor(nbPattes: number){
  16. super('noir', nbPattes)
  17. }
  18. }
  19. class Chats extends Animaux4P{
  20. constructor(color: string){
  21. super(color)
  22. }
  23. }
  24. class Chiens extends Animaux4P{
  25. constructor(color: string){
  26. super(color)
  27. }
  28. }
  29. class Oiseaux extends Animaux{
  30. constructor(color: string){
  31. super(color, 2)
  32. }
  33. }
  34. class Poissons extends Animaux{
  35. constructor(color: string){
  36. super(color, 0)
  37. }
  38. }
  39.  
  40. function etrePrisEnPhoto(animaux: Animaux): void{
  41. console.log("Belle photo")
  42. };
  43. function etreCaresse(animauxl4P: Animaux4P): void{
  44. console.log("Encore des caresse")
  45. };
  46. function miauler(chats: Chats): void{
  47. console.log("Miaaaou")
  48. };
  49. function etreNourris(animeauxNoir: AnimauxNoir): void{
  50. console.log("Miam-Miam")
  51. };
  52. function nager(poissons: Poissons): void{
  53. console.log("Ploufffff")
  54. };
  55. function aboyer(chiens: Chiens): void{
  56. console.log("Wahouffff")
  57. };
  58. function voler(oiseaux: Oiseaux): void{
  59. console.log("I believed I can....")
  60. };
  61.  
  62. const algo = new Chats('roux')
  63. miauler(algo)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement