javascript function object's inheritFrom method

Posted by gawpertron on Stack Overflow See other posts from Stack Overflow or by gawpertron
Published on 2010-12-29T21:18:54Z Indexed on 2010/12/29 21:54 UTC
Read the original article Hit count: 178

Filed under:
|
|
|
|

I've come across this.inheritFrom that enables you to inherit from a super class.

var superClass = function() {
    this.foo = 'foo';
    this.bar = 'bar';
}

var subClass = function() {
    this.inheritFrom = superClass;
    this.inheritFrom();
    this.myFunction = function() {
        return this.foo;
    };
}

I've looked in Mozilla and MSDN, but I can't seem to find it documented any where. As far as I can see it works in IE6 and Firefox 3. Any reason why it wouldn't be documented?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about oop