`
cy729215495
  • 浏览: 127230 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

use of prototype and call

 
阅读更多

 

functionStickman(){
//some methods and properties
}

functionJuniorStickman(){

Stickman.call(this);

this.p =new value // override a property in Stickman
}

JuniorStickman.prototype =new Stickman();

junior =new JuniorStickman();


call方法的作用,就像别的语言的super方法。但JuniorStickman.prototype =newStickman();是干嘛的,call方法已经让子类继承了父类所有的方法呀,还要他干嘛?
   原来它是继承父类的原型链的。但这种写法也不行。

如果Stickman有很多参数,那是不行的。
 JuniorStickman.prototype =Object.create(Stickman.prototype);就可以了

 

分享到:
评论

相关推荐

    GPU Instancer v1.5.4

    – Ability to use custom shadow distance per prototype and to choose the LOD to render shadows with. – Support for Floating Origin handling. – Multiple camera support. – Well documented API for ...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    Length Arrays and alloca() Friends Exceptions Run-Time Type Information (RTTI) Casting Streams Preincrement and Predecrement Use of const Integer Types 64-bit Portability Preprocessor Macros 0 and ...

    Transistor Amplifiers

    I maintain the well-established use of upper- and lower-case letters and subscripts for static and incremental quantities, though I abandon the upper-lower case distinction for time and complex-...

    移动代理源代码

    Let's call JMF2.1.1 the installation directory of the JMF and JSDK the installation directory of the JSDK. Copy there files: ./JMF2.1.1/lib/jmf.jar ./JMF2.1.1/lib/sound.jar to the directory: ./...

    acpi控制笔记本风扇转速

    code size, and reduces CPU stack use. (Valery Podrezov + interpreter changes in version 20051202 that eliminated namespace loading during the pass one parse.) Implemented _CID support for PCI Root ...

    Turbo C 2.00[DISK]

    Computer brand, model, and the brands and model numbers of any additional hardware. d. Operating system and version number. (The version number can be determined by typing VER at the MSDOS prompt...

    Prototype Enumerable对象 学习第1/2页

    Enumerable provides a large set of useful methods for... Enumerable is what we like to call a module: a consistent set of methods intended not for independent use, but for mixin: incorporation into other

    Prototype PeriodicalExecuter对象 学习

    This is a simple facility for periodical execution of a function. This essentially encapsulates the native clearInterval/setInterval mechanism found in native Window ... use a prompt or confirm call): th

    simplewebrtc.js webrtc网页视频开发帮助工具

    var args = [].slice.call(arguments, 1), callbacks = this.callbacks[event], specialCallbacks = this.getWildcardCallbacks(event), i, len, item; if (callbacks) { for (i = 0, len = callbacks....

    Replacing "RICHEDIT" control with "RichEdit20A"

    This is almost exactly what is in CRichEditCtrl::Create(), except the different window class name, and the call to AfxInitRichEdit() has been changed to AfxInitRichEditEx() which first calls ...

    C++出错提示英汉对照表

    Call to function with no prototype ---------------调用函数时没有函数的说明 Cannot modify a const object ---------------不允许修改常量对象 Case outside of switch ----------------漏掉了case 语句 Case...

    weapp.qrcode.js

    var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); // Not own constructor property must be Object if (obj.constructor &&...

    hls.min.js

    return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/hls.js/dist/",e(e.s=7)}([function(t,e,r){"use strict";function i(){}function a(t,e){return e="["+t+"] >...

    ES6转JavaScriptesnext.zip

    console.log(join.apply(null, ['-'].concat($__Array$prototype$slice.call([415, 555, 1212])))); 使用方法: var transpiler = require('es6-module-transpiler'); var Container = transpiler....

    eos的Node.js开发包node-eos.zip

     use_mock: true, //controll global mock   mock_config_file: __dirname "/config_mock.json" //mock config file path }); definde a eos service module.exports = function(eos){  function ...

    js.rar(react初学者简单测试用babel.js,react-development.js,react-dom.js)

    return t.m=e,t.c=r,t.p="",t(0)}(function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))switch(typeof e[t]){case"function":break;case"object":e[t]=function(t){var r=t.slice(1),n=e[t[0]...

    truffle4.1.12报错

    return t.d(a,"a",a),a},t.o=function(e,a){return Object.prototype.hasOwnProperty.call(e,a)},t.p="",t.w={},t(t.s=1036)}([function(e,a,t){try{var c=t(1);if("function"!=typeof c.inherits)throw"";e.exports...

    彩虹岛Java源码-nbamap:地图

    Object.prototype.toString.call(v).replace(/^\[object *|\]$/g,"")}function IsCallable(o){return typeof o==="function "}function ToObject(v){if(v===null||v====undefined)throw TypeError

    tweenjs.min.js文件

    function c(){this.constructor=a}return c.prototype=b.prototype,a.prototype=new c},this.createjs=this.createjs||{},createjs.promote=function(a,b){"use strict";var c=a.prototype,d=Object.getPrototypeOf&...

Global site tag (gtag.js) - Google Analytics