Skip to content

Instantly share code, notes, and snippets.

@Nocktiss
Created March 19, 2019 00:03
Show Gist options
  • Save Nocktiss/e823077fff43953e676e4b38bad3ec74 to your computer and use it in GitHub Desktop.
Save Nocktiss/e823077fff43953e676e4b38bad3ec74 to your computer and use it in GitHub Desktop.
POO1_Wild
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