Skip to content

Instantly share code, notes, and snippets.

@mohanadkaleia
Created April 13, 2018 03:34
Show Gist options
  • Save mohanadkaleia/908a6e901b1c557e72b4ef99d3a8cea0 to your computer and use it in GitHub Desktop.
Save mohanadkaleia/908a6e901b1c557e72b4ef99d3a8cea0 to your computer and use it in GitHub Desktop.
class User {
constructor(name) {
this.name = name;
}
sayHi() {
console.log(`Hi, ${this.name}`);
}
}
class Admin extends User {
constructor(name) {
super(name);
this.isAdmin = true;
}
sayHi() {
console.log(`Hi, my name is Admin ${this.name}`);
}
}
let admin = new Admin('Mohanad');
admin.sayHi(); // Hi, my name is Admin Mohanad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment