Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- abstract class Animaux{
- color: string;
- nbPattes: number;
- constructor(color: string, nbPattes: number){
- this.color = color;
- this.nbPattes = nbPattes;
- }
- }
- class Animaux4P extends Animaux{
- constructor(color: string){
- super(color, 4)
- }
- }
- class AnimauxNoir extends Animaux{
- constructor(nbPattes: number){
- super('noir', nbPattes)
- }
- }
- class Chats extends Animaux4P{
- constructor(color: string){
- super(color)
- }
- }
- class Chiens extends Animaux4P{
- constructor(color: string){
- super(color)
- }
- }
- class Oiseaux extends Animaux{
- constructor(color: string){
- super(color, 2)
- }
- }
- class Poissons extends Animaux{
- constructor(color: string){
- super(color, 0)
- }
- }
- function etrePrisEnPhoto(animaux: Animaux): void{
- console.log("Belle photo")
- };
- function etreCaresse(animauxl4P: Animaux4P): void{
- console.log("Encore des caresse")
- };
- function miauler(chats: Chats): void{
- console.log("Miaaaou")
- };
- function etreNourris(animeauxNoir: AnimauxNoir): void{
- console.log("Miam-Miam")
- };
- function nager(poissons: Poissons): void{
- console.log("Ploufffff")
- };
- function aboyer(chiens: Chiens): void{
- console.log("Wahouffff")
- };
- function voler(oiseaux: Oiseaux): void{
- console.log("I believed I can....")
- };
- const algo = new Chats('roux')
- miauler(algo)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement