Classes Part 2 - Extend Class From Another Module
محتوى الدرس
main.js
class User {
constructor(name, email) {
this.name = name;
this.email = email;
}
getInfo() {
console.log(`Hello ${this.name} Your Email is ${this.email}`);
}
}
export default User;
// main.js
/*
OOP => Classes Part 2
Extend Class From Another Module
*/
import User from './app.js';
class Admin extends User {
constructor(name, email) {
super(name, email);
}
}
let firstAdmin = new Admin("Osama", "[email protected]");
firstAdmin.getInfo();