From ea62d6a4fc6b8919e08b87cbc8d25640b6677276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Allienne?= Date: Tue, 23 Jan 2018 21:39:41 +0100 Subject: [PATCH] solution: Add solution for classes Close #7 --- exercises/classes/exo.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/exercises/classes/exo.js b/exercises/classes/exo.js index c8765c4..d18264a 100644 --- a/exercises/classes/exo.js +++ b/exercises/classes/exo.js @@ -1,7 +1,33 @@ class Cat { + + constructor(name) { + this.name = name; + } + + meow() { + console.log('meow'); + } + + play() { + console.log('play'); + } } -class MainCoon { +class MainCoon extends Cat { + + constructor(name, color) { + super(name); + this.color = color; + } + + play() { + super.play(); + console.log('Super play'); + } + + sleep() { + console.log('Super sleep') + } } module.exports = {Cat, MainCoon};