最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Javascript 對(duì)象的解釋

 更新時(shí)間:2008年11月24日 21:39:31   作者:  
ECMAScript沒(méi)有像C++,Smalltalk,或者java中那樣規(guī)矩的類,可是它支持通過(guò)執(zhí)行分配空間的代碼來(lái)創(chuàng)建對(duì)象、并初始化對(duì)象所有或者一部分屬性的構(gòu)造器。
所有的構(gòu)造器都是對(duì)象,而并非所有的對(duì)象都是構(gòu)造器.每個(gè)構(gòu)造器都有一個(gè)用來(lái)實(shí)現(xiàn)原型繼承、共享屬性的Prototype屬性。對(duì)象通過(guò)new 表達(dá)式創(chuàng)建;比如,new String("A String") 創(chuàng)建了一個(gè)String對(duì)象。沒(méi)有通過(guò)new而直接調(diào)用構(gòu)造器將有返回值,返回的類型將取決于構(gòu)造器。例如String("A String")產(chǎn)生一個(gè)原始的類型的字符串而不是一個(gè)對(duì)象。
ECMAScript支持基于原型的繼承。每個(gè)構(gòu)造器都有一個(gè)與之關(guān)聯(lián)的原型,而且通過(guò)此構(gòu)造器創(chuàng)建的對(duì)象都有一個(gè)與構(gòu)造器原型關(guān)聯(lián)的隱式引用(稱為,對(duì)象的原型)。進(jìn)一步說(shuō),一個(gè)原型可能有一個(gè)對(duì)其原型的非空隱式引用……,這被稱為,原型鏈。當(dāng)一個(gè)引用指向?qū)ο蟮膶傩?,這個(gè)引用指向原型鏈中的第一個(gè)對(duì)象的以此為名的屬性。換句話說(shuō),第一次,這個(gè)直接關(guān)聯(lián)的對(duì)象,將為這個(gè)屬性被檢查。如果這個(gè)對(duì)象包含以此為名的屬性,這個(gè)屬性就是引用指向的屬性。如過(guò)這個(gè)對(duì)象不包含以此為名的屬性,那么這個(gè)對(duì)象的原型將會(huì)被繼續(xù)檢查……
原文:
Object
ECMAScript does not contain proper classes such as those in C++, Smalltalk, or Java, but rather,supports constructors which create objects by executing code that allocates storage for the objects and initialises all or part of them by assigning initial values to their properties. All constructors are objects,but not all objects are constructors. Each constructor has a Prototype property that is used to implement prototype-based inheritance and shared properties. Objects are created by using constructors in new expressions; for example, new String("A String") creates a new String object. Invoking a constructor without using new has consequences that depend on the constructor. For example,String("A String") produces a primitive string, not an object.
ECMAScript supports prototype-based inheritance. Every constructor has an associated prototype, and every object created by that constructor has an implicit reference to the prototype (called the object's prototype) associated with its constructor. Furthermore, a prototype may have a non-null implicit reference to its prototype, and so on; this is called the prototype chain. When a reference is made to a property in an object, that reference is to the property of that name in the first object in the prototype chain that contains a property of that name. In other words, first the object mentioned directly is examined for such a property; if that object contains the named property, that is the property to which the reference refers; if that object does not contain the named property, the prototype for that object is examined next; and so on.

相關(guān)文章

  • javascript 面向?qū)ο缶幊袒A(chǔ) 多態(tài)

    javascript 面向?qū)ο缶幊袒A(chǔ) 多態(tài)

    javascript 面向?qū)ο缶幊袒A(chǔ) 多態(tài) 的實(shí)現(xiàn)方法說(shuō)明,大家可以看下下面的代碼。
    2009-08-08
  • JavaScript 工具庫(kù) Cloudgamer JavaScript Library v0.1 發(fā)布

    JavaScript 工具庫(kù) Cloudgamer JavaScript Library v0.1 發(fā)布

    研究了一年多的js,也差不多寫(xiě)一個(gè)自己的js庫(kù)了。 我寫(xiě)這個(gè)不算框架,只是一個(gè)小型的js工具庫(kù),所以我用的名字是Library。
    2009-10-10
  • 最新評(píng)論

    上杭县| 海安县| 镇巴县| 禹城市| 珠海市| 策勒县| 富蕴县| 修文县| 永登县| 涪陵区| 谢通门县| 东海县| 双柏县| 定边县| 开远市| 收藏| 丽水市| 慈溪市| 德昌县| 云浮市| 太仆寺旗| 偏关县| 怀宁县| 肇源县| 普陀区| 惠安县| 油尖旺区| 建昌县| 新源县| 苏州市| 泸定县| 梁山县| 栖霞市| 特克斯县| 阿图什市| 雅江县| 柳河县| 大邑县| 白银市| 齐河县| 定州市|