You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Manager.prototype = Employee.prototype; // kerana bukan jadi pewarisan, tapi malah nge replace prototype Manager menjadi prototype Employee
25
+
26
+
Manager.prototype.sayHello = function (name) {
27
+
console.info(`Hello ${name}, my name is Manager ${this.name}`)
28
+
}
29
+
30
+
Employee.prototype.sayHello = function (name) {
31
+
console.info(`Hello ${name}, my name is Employee ${this.name}`)
32
+
}
33
+
**/
34
+
35
+
functionEmployee(name){
36
+
this.name=name;
37
+
}
38
+
functionManager(name){
39
+
this.name=name;
40
+
}
41
+
42
+
Manager.prototype=Object.create(Employee.prototype);// kerana bukan jadi pewarisan, tapi malah nge replace prototype Manager menjadi prototype Employee
43
+
44
+
Manager.prototype.sayHello=function(name){
45
+
console.info(`Hello ${name}, my name is Manager ${this.name}`)
46
+
}
47
+
48
+
Employee.prototype.sayHello=function(name){
49
+
console.info(`Hello ${name}, my name is Employee ${this.name}`)
0 commit comments