Created
April 20, 2019 06:54
-
-
Save MeetMartin/07b0982155d346a7b502951ccf9014d7 to your computer and use it in GitHub Desktop.
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 characters
import {Animal, Dog} from './animals'; | |
import {Robot} from './robots'; | |
class RoboDog { | |
constructor(animal, dog, robot) { | |
this.animal = new animal(); | |
this.dog = new dog(); | |
this.robot = new robot(); | |
} | |
move() { | |
return this.animal.move(); | |
} | |
bark() { | |
return this.dog.bark(); | |
} | |
chargeBattery() { | |
return this.robot.chargeBattery(); | |
} | |
roboBark() { | |
return 2 * this.dog.bark(); | |
} | |
} | |
const roboDog = new RoboDog(Animal, Dog, Robot); | |
roboDog.roboBark(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment