Monday, October 22, 2007

Ajax (1)


Type.registerNamespace("AspNetAjaxOverView");

AspNetAjaxOverView.Person = function(firstName, lastName) //constructor

{

this._firstName = firstName;

this._lastName = lastName;

}

AspNetAjaxOverView.Person.prototype =

{

get_firstName : function() //property

{

return this._firstName;

},

get_lastName : function()

{

return this._lastName;

},

toString : function() //method

{

return String.format("Hello, I'm {0} {1}.",

this.get_firstName(),

this.get_lastName());

}

}

AspNetAjaxOverView.Person.registerClass("AspNetAjaxOverView.Person");

AspNetAjaxOverView.Employee = function(firstName, lastName, title)

{

AspNetAjaxOverView.Employee.initializeBase(this, [firstName, lastName]); //inherit base constructor

this._title = title;

}

AspNetAjaxOverView.Employee.prototype =

{

get_title : function()

{

return this._title;

},

toString : function()

{

return AspNetAjaxOverView.Employee.callBaseMethod(this, "toString") +

" My title is '" + this.get_title() + "'.";

}

}

AspNetAjaxOverView.Employee.registerClass("AspNetAjaxOverView.Employee", AspNetAjaxOverView.Person); //declare the inheritance

blog comments powered by Disqus