My problem here that i don't understand why this override do not work here is the source
window.onload=function()
{
function Person(first,last)
{
this.First=first;
this.Last = last;
this.Full=function()
{
return this.First+" "+this.Last;
};
}
Person.prototype.GetFullName=function()
{
return this.First + " " + this.Last;
} ;
function Employee(first,last,position)
{
Person.call(this,first,last);
this.Position=position;
}
/* Employee.prototype = new Person();
var t = new Employee("Mohamed","Zaki","Web Developer");
alert(t.GetFullName());
*/
Employee.prototype.GetFullName=function()
{
var x = Person.prototype.GetFullName.call(this);
return x + " , " + this.Position ;
}
var e = new Employee("Mohamed","Zaki","Web Developer");
alert(e.GetFullName());
}
}), it alertsMohamed Zaki , Web Developer. What were you expecting?this.Position=position, nothing ever reads it. were you expecting it to be in GetFullName? maybe you intended to include more code in the comment?