Static function.

Base function implementing inheritance in JavaScript. Implements prototype inheritance without executing the parent constructor. The "superclass" field is appended to the child class, specifying the prototype of the parent class and the 'constructor' field, specifying the constructor of the class. Use the 'constructor' field of the 'superclass' object to refer to the constructor of the parent class.

Returns a prototype of the child class.

{ Object } util.augment(ChildClass, ParentClass, override)


ParameterDefault valueDescription
ChildClass *

Type: Function

Child class.

ParentClass *

Type: Function

Parent class.

override *

Type: Object

Set of additional fields and functions that will be appended to the prototype of the child class.

* Mandatory parameter/option.


// Parent class
var ParentClass = function (param1, param2) {
    this.param1 = param1;
    this.param2 = param2;

ParentClass.prototype = {
    foo: function () {
// Child class
var ChildClass = function (param1, param2, param3) {
    // Calling the parent's constructor
    ChildClass.superclass.constructor.call(this, param1, param2);
    this._param3 = param3;

// inheriting ChildClass from ParentClass
ymaps.util.augment(ChildClass, ParentClass, {
    // redefining the "foo" method in the descendant
    foo: function () {
        // Calling the parent class method