Microsoft Ajax Series Part 2
In this Fiddle you get test the Inheritance system of the Microsoft Ajax Library
by deeptechtons
HTML
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/3.5/MicrosoftAjax.js"></script>
JavaScript
//register global Factory object
Type.registerNamespace("Factory");
//create Automobile class inside the factory
Factory.Automobile = function(type) {
this._type = type || '';
};
Factory.Automobile.prototype = {
_type: null,
get_type: function() {
alert(this._type);
}
};
Factory.Automobile.registerClass("Factory.Automobile", null);
//create Car class Inheriting from automobile
Factory.Car = function(maker) {
Factory.Car.initializeBase(this, [this._automobileType]);
this._carMaker = maker || '';
};
Factory.Car.prototype = {
_automobileType: "CAR",
_carMaker: null,
get_carMaker: function() {
alert(this._carMaker);
}
};
Factory.Car.registerClass("Factory.Car", Factory.Automobile);