# Namespace goog.defineClass

code »

Creates a restricted form of a Closure "class": - from the compiler's perspective, the instance returned from the constructor is sealed (no new properties may be added). This enables better checks. - the compiler will rewrite this definition to a form that is optimal for type checking and optimization (initially this will be a more traditional form).

## Main

defineClass ( superClass, def ) ⇒ `!Function`

Parameters
superClass: `Function` The superclass, Object or null. def: `goog.defineClass.ClassDescriptor` An object literal describing the the class. It may have the following properties: "constructor": the constructor function "statics": an object literal containing methods to add to the constructor as "static" methods or a function that will receive the constructor function as its only parameter to which static properties can be added. all other properties are added to the prototype.
Returns
The class constructor.

Show:Public Protected Private

## Type Definitions

code »goog.defineClass.ClassDescriptor : `(!Object|{constructor: !Function}|{constructor: !Function, statics: (Object|function(Function): void)})`
No description.

## Global Functions

code »goog.defineClass.applyProperties_ ( target, source )

Parameters
target: `!Object` The object to add properties to. source: `!Object` The object to copy properites from.

code »goog.defineClass.createSealingConstructor_ ( ctr, superClass ) ⇒ `!Function`

If goog.defineClass.SEAL_CLASS_INSTANCES is enabled and Object.seal is defined, this function will wrap the constructor in a function that seals the results of the provided constructor function.

Parameters
ctr: `!Function` The constructor whose results maybe be sealed. superClass: `Function` The superclass constructor.
Returns
The replacement constructor.

## Global Properties

code »goog.defineClass.OBJECT_PROTOTYPE_FIELDS_ : `!Array.<string>`

The names of the fields that are defined on Object.prototype.

## Compiler Constants

code »goog.defineClass.SEAL_CLASS_INSTANCES : `boolean`