Constructor
new Class() → {FooTable.Class}
This base implementation does nothing except provide access to the
FooTable.Class#extend
method.
- See:
Returns:
- Type
- FooTable.Class
Methods
(static) extend(arg1, arg2) → {FooTable.Class}
Creates a new class that inherits from this class which in turn allows itself to be extended or if a name and function is supplied extends only that specific function on the class.
Parameters:
Name | Type | Description |
---|---|---|
arg1 |
object | string | An object containing any new methods/members to implement or the name of the method to extend. |
arg2 |
function | If the first argument is a method name then this is the new function to replace it with. |
Returns:
A new class that inherits from the base class.
- Type
- FooTable.Class
Example
The below shows an example of how to implement inheritance using this method.
var Person = FooTable.Class.extend({ construct: function(isDancing){ this.dancing = isDancing; }, dance: function(){ return this.dancing; }});var Ninja = Person.extend({ construct: function(){ this._super( false ); }, dance: function(){ // Call the inherited version of dance() return this._super(); }, swingSword: function(){ return true; }});var p = new Person(true);p.dance(); // => truevar n = new Ninja();n.dance(); // => falsen.swingSword(); // => true// Should all be truep instanceof Person && p instanceof FooTable.Class &&n instanceof Ninja && n instanceof Person && n instanceof FooTable.Class