# Class: Class

## FooTable.Class

This class is based off of John Resig's Simple JavaScript Inheritance but it has been updated to be ES 5.1 compatible by implementing an Object.create polyfill for older browsers.

## Constructor

#### new Class() → {FooTable.Class}

This base implementation does nothing except provide access to the `FooTable.Class#extend` method.

See:
  - http://ejohn.org/blog/simple-javascript-inheritance
  - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Polyfill

##### 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(); // => true

    var n = new Ninja();
    n.dance(); // => false
    n.swingSword(); // => true

    // Should all be true
    p instanceof Person && p instanceof FooTable.Class &&
    n instanceof Ninja && n instanceof Person && n instanceof FooTable.Class