Namespace: inheritance

og.inheritance

JavaScript objects inheritage functions.

Methods

staticog.inheritance.base()

Call up to the superclass. This function only works if you use og.inheritance.extend to express inheritance relationships between your classes. See og.inheritance.extend

staticog.inheritance.extend(Child, Parent)

Inherit the prototype methods from one constructor into another. Usage:
function ParentClass(a, b) { }
ParentClass.prototype.foo = function(a) { };

function ChildClass(a, b, c) {
  og.inheritance.base(this, a, b);
}
og.inheritance.extend(ChildClass, ParentClass);

var child = new ChildClass('a', 'b', 'see');
child.foo(); // This works.
Name Type Description
Child function Child class.
Parent function Parent class.