Created
March 19, 2019 00:03
-
-
Save Nocktiss/e823077fff43953e676e4b38bad3ec74 to your computer and use it in GitHub Desktop.
POO1_Wild
This file contains 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
class Person { | |
constructor(name, age) { | |
this.name = name; | |
this.age = age; | |
} | |
tellMyName() { | |
console.log(`I am ${this.name}̀`); | |
} | |
tellMyAge() { | |
console.log(`I am ${this.age} years old`); | |
} | |
} | |
const antho = new Person('Antho', 29); | |
antho.tellMyName(); | |
antho.tellMyAge(); | |
class Student extends Person { | |
constructor(name, age) { | |
super(name, age) | |
} | |
} | |
const john = new Student('Mary', 35) | |
const mary = new Student('John', 40) | |
john.tellMyName(); | |
john.tellMyAge(); | |
mary.tellMyName(); | |
mary.tellMyAge(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment