Class.extend

Creates new class.

Syntax

existingClass.extend( instance_methods [, class_methods] )

Parameters

Parameter Description
instance_methods object containing members that will become instance members of defined class
class_methods object containing members that will become class (static) members of defined class

Description

Class allows easy construction of JavaScript objects that implement classic OO inheritance.

Defining constructors

Constructors are defined using special method init

The name of init function (in this case MyClass) is going to be used as a name of object's constructor function:

Calling overridden base class member

Returns.

New class definition (constructor function).

Example

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Feb 26, 2011

    Dmitry Yakunin says:

    Pasha, Thank you for attention to these parts. We are currently using similar b...

    Pasha,

    Thank you for attention to these parts. We are currently using similar but a bit different convention:

    and use init function name as a "class name" to show in debug output etc.

    We are going to reflect it on this page.