New to Kendo UI for jQueryStart a free 30-day trial

Extend

class methods

Extends an existing class with new methods.

Parameters:prototypeObject

A key/value pair of all methods that the new class will have.

Returns:Object

a new class which inherits the base methods.

<script>
var Animal = kendo.Class.extend({
    move: function() {
/* The result can be observed in the DevTools(F12) console of the browser. */
        console.log("Animal.move()");
    }
});

var Bird = Animal.extend({
   move: function() {
        Animal.fn.move.call(this);

/* The result can be observed in the DevTools(F12) console of the browser. */
        console.log("Fly");
   }
});

var Cat = Animal.extend({
   move: function() {
        Animal.fn.move.call(this);

/* The result can be observed in the DevTools(F12) console of the browser. */
        console.log("Sneak");
   }
});

var tweety = new Bird();

tweety.move(); // outputs "Animal.move()" then "Fly"

var sylvester = new Cat();

sylvester.move(); // outputs "Animal.move()" then "Sneak"

/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(tweety instanceof Bird); // outputs "true" because tweety is an instanfe of Bird

/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(tweety instanceof Animal); // outputs "true" because Animal is the base class of Bird

/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(tweety instanceof Cat); // outputs "false" because tweety is not an instance of Cat
</script>
Not finding the help you need?
Contact Support