ASP.NET AJAX 教学笔记(三) 2
3.4理解继承
一.基于原型的继承:
步骤:
(1)在子类构造函数中调用基类构造函数,从而继承基类的属性。
(2)将基类的一个新实例赋给子类,从而继承基类的方法。
Samples.Cat=function()
{
Samples.Pet.call(this);
}
Samples.Cat.prototype =new Samples.Pet(); //测试代码
Samples.Pet.registerClass('Samples.Pet');
Samples.Cat.registerClass('Samples.Cat');
调用:
var cc=new Samples.Cat();
cc.set_name("白猫");
cc.speak();
覆盖方法:
Samples.Cat.prototype.speak=function (){alert ('meeeewooooo')};
二.Microsoft Ajax Library从一个基类派生子类
function Pet()
{
this._name;
this._age;
}
Pet.prototype={
speak:function (){
alert (this._name+"Meeeeooow"); }
}
Cat=function (){
Cat.initializeBase(this ); //处理继承并调用基类构造函数
Samples.Cat.registerClass('Samples.Cat',Samples.Pet)
调用:代码不变
覆盖方法:
Samples.Cat.prototype={
speak:function (){
alert ("Meeeeooow");
}
}
测试:代码不变
3.4.2向基类传递参数
Samples.Pet= function (name ,age)
{
this._name=name ;
this._age=age;
}
…..
Samples.Cat=function (name,age)
{
Samples.Cat.initializeBase(this,[name,age]);
}
……&hel
相关文档:
一.通过js访问Flex组件
1.准备工作。先建立Flex工程 :fademo,并放置一个文本框:txtName。做完后代码应该类似于这个样子:
view plaincopy to clipboardprint?
·········10······· ......
在网上下了IngelliJ9.0,安装完成后,迫不及待的打开,却提示“The JVM could not be started. The main method may have thrown an exception.” 又去网上找了找,解决的办法是把bin目录下的idea.exe.vmoptions 文件有写字板打开,把里面的内容该为-Xms32m
-Xmx512m
-XX:MaxPermSize=120m
-ea
......
建立一个WEB工程,添加新项->HTML页面,命名为ProgressBar.htm,内容如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" id="mainWindo ......