function Manager () {
this.reports = [];
}
Manager.prototype = new Employee;
Showing posts with label Inheritance. Show all posts
Showing posts with label Inheritance. Show all posts
Tuesday, June 26, 2007
Inheritance
Say you have an Employee "class" and a Manager "class" (which will inherit from Employee). First, create a constructor function with the definition of the employee, and likewise for the Manager. To create the inheritance link, set the prototype property of the Manger's constructor function to an employee object:
Subscribe to:
Posts (Atom)