Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.94 KB | None | 0 0
  1. interface Animaux {
  2. type: string;
  3. color: string;
  4. }
  5. function photo(animaux: Animaux) {
  6. console.log("I'm " + animaux.type + " you can take a picture of me ");
  7. }
  8.  
  9. class Chat {
  10. type: string;
  11. color: string;
  12. constructor(type: string, color: string) {
  13. this.type = type;
  14. this.color = color;
  15. }
  16. photo() {
  17. console.log("I'm " + this.type + " you can take a picture of me ");
  18. }
  19. miaul(){
  20. console.log('Miaouuuuuuh')
  21. }
  22.  
  23. }
  24.  
  25. class Chien {
  26. type: string;
  27. color: string;
  28. constructor(type: string, color: string) {
  29. this.type = type;
  30. this.color = color;
  31. }
  32. photo() {
  33. console.log("I'm " + this.type + " you can take a picture of me ");
  34. }
  35. aboie(){
  36. console.log("Waaaaaaaf")
  37. }
  38. }
  39.  
  40. class Oiseaux {
  41. type: string;
  42. color: string;
  43. constructor(type: string, color: string) {
  44. this.type = type;
  45. this.color = color;
  46.  
  47. }
  48. photo() {
  49. console.log("I'm " + this.type + " you can take a picture of me ");
  50. }
  51. vole(){
  52. console.log("Je vooooolee car je suis un "+ this.type)
  53. }
  54.  
  55. }
  56.  
  57. class Poisson {
  58. type: string;
  59. color: string;
  60. constructor(type: string, color: string) {
  61. this.type = type;
  62. this.color = color;
  63.  
  64. }
  65. photo() {
  66. console.log("I'm " + this.type + " you can take a picture of me ");
  67. }
  68. nage(){
  69. console.log("Je nage et pas dans un bocal")
  70. }
  71. }
  72.  
  73. class chatE extends Chat {
  74. nbPates: number;
  75.  
  76. constructor(type:string, color:string, nbPates:number) {
  77. super(type, color);
  78. this.nbPates = nbPates;
  79. }
  80. caresse() {
  81. console.log("Tu peux me caresser car" + this.nbPates+ " pattes");
  82. }
  83.  
  84. noir() {
  85. console.log("Je suis noir")
  86. }
  87. }
  88.  
  89. class chatC extends Chat {
  90. nbPates: number;
  91.  
  92. constructor(type:string, color:string, nbPates:number) {
  93. super(type, color);
  94. this.nbPates = nbPates;
  95. }
  96. caresse() {
  97. console.log("Tu peux me caresser car" + this.nbPates+ " pattes");
  98. }
  99. }
  100.  
  101. class chienMoonMoon extends Chien {
  102. nbPates: number;
  103.  
  104. constructor(type:string, color:string, nbPates:number) {
  105. super(type, color);
  106. this.nbPates = nbPates;
  107. }
  108. caresse() {
  109. console.log("Tu peux me caresser car" + this.nbPates+ " pattes");
  110. }
  111. }
  112.  
  113. class chienTerreNeuve extends Chien {
  114. nbPates: number;
  115.  
  116. constructor(type:string, color:string, nbPates:number) {
  117. super(type, color);
  118. this.nbPates = nbPates;
  119. }
  120. caresse() {
  121. console.log("Tu peux me caresser car j'ai " + this.nbPates + " pattes");
  122. }
  123. noir() {
  124. console.log("Je suis noir")
  125. }
  126. }
  127.  
  128. class Merle extends Oiseaux {
  129.  
  130. constructor(type:string, color:string, ) {
  131. super(type, color);
  132. }
  133.  
  134. noir() {
  135. console.log("Je suis noir")
  136. }
  137. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement