Created
April 13, 2018 03:34
-
-
Save mohanadkaleia/908a6e901b1c557e72b4ef99d3a8cea0 to your computer and use it in GitHub Desktop.
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 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