Hello,
I came across a website that uses diagrams to show what objects look like in memory,
http://www.objectplayground.com/He defines 2 types of inheritance, Classical and Resig. So my question is does jQuery ( the framework ) just use Resig style inheritance and would that style be prototype instead of classical? The author seems to suggest that classical is better then prototype. And at the same time jQuery is based on prototype - "Resig style".
In jQuery is it always one way or the other, or does the framework use classical as well? If you had to choose one style to learn would this be prototype for jQuery?
Also how would you convert: ( Classical Inheritance Example )
// Parent class constructor
function Parent() {
this.a = 42;
}
// Parent class method
Parent.prototype.method = function method() {};
// Child class constructor
function Child() {
Parent.call(this);
this.b = 3.14159
}
// Inherit from the parent class
Child.prototype = Object.create(Parent.prototype);
Child.prototype.constructor = Child;
// Child class method
Child.prototype.method = function method() {
Parent.prototype.method.call(this);
};
// Instantiate
this.instance = new Child();
TO RESIG Inheritance?
Thanks,
Jim