can.Construct
Provides a way to easily use the power of prototypal inheritance without worrying about hooking up all the particulars yourself. Use can.Construct.extend to create an inheritable constructor function of your own.
Provides a way to easily use the power of prototypal inheritance without worrying about hooking up all the particulars yourself. Use can.Construct.extend to create an inheritable constructor function of your own.
Use
In the example below,
Animalis a constructor function returned by can.Construct.extend. All instances ofAnimalwill have aspeakmethod, and theAnimalconstructor has alegsproperty.You can make instances of your object by calling your constructor function with the
newkeyword. When an object is created, the init method gets called (if you supplied one):Plugins
There are two plugins available to help make using
can.Constructeven simpler.this._superavailable in inherited methods.thisto an instance of the constructor function.