javacript prototype 解密
来源:互联网 发布:车管家软件是什么 编辑:程序博客网 时间:2024/05/29 15:21
看了一下关于prototype的文章,但是,太书面化了,不易理解,我将prototype还原成类对象,和大家分享一下,如果不对,欢迎拍砖!
测试代码 1
测试代码 2
- ///原型对象
- public class prototype
- {
- //attribute
- public object constructor;
- //init
- public prototype(constructor)
- {
- self.constructor = constructor;
- }
- //调用 prototype
- public object prototype()
- {
- return this.parent; // prototype
- }
- //设置prototype值
- public void .=(key,value)
- {
- set(key,value);
- }
- }
- ///Function对象
- public class function : prototype
- {
- //attribute
- public ArrayArguments arguments;
- public object prototype = prototype();
- //init
- public function()
- {
- //调用基类
- super(this);
- //建立初始化属性
- //处理 arguments
- }
- //call me
- public callee()
- {
- function();
- }
- }
测试代码 1
- function abc()
- {
- };
- function cba()
- {
- this.c = "cba.prototype";
- }
- cba.prototype.d="d";
- //abc对象继承cba对象
- abc.prototype = new cba();
- //实例化ABC对象
- var obj = new abc();
- abc.prototype.c = "abc.prototype";
- obj.c = "self";
- //打印对象间继承关系
- alert(obj.c);
- alert(abc.prototype.c);
- alert(abc.prototype.d);
- alert(obj.d);
测试代码 2
- function abc()
- {
- };
- var obj = new abc();
- obj.c = "self";
- //打印对象属性
- alert(obj.c);
- //打印继承prototype对象属性
- alert(abc.prototype.c); //undefine
- abc.prototype.c = "abc.prototype";
- alert(obj.c); //self
- alert(abc.prototype.c); //"abc.prototype";
- javacript prototype 解密
- javacript prototype基础
- 深入理解javacript之prototype
- 深入理解Javacript之Prototype
- javacript
- javacript 函数库
- javacript基本知识
- javacript回车
- Javacript OOP
- javacript小游戏
- javacript语句
- JavaCript日期
- javacript 对象
- Javacript陷阱
- Prototype
- ProtoType
- prototype
- prototype
- lr_save_string和sprintf的使用
- 观止——微软创建NT和未来的夺命狂奔
- Net下XML文档的读写操作
- SqlServer中文乱码(其他数据库也可参考)
- 算法系列之五:最长公共子序列(LCS)问题(非连续子序列)的两种解法
- javacript prototype 解密
- Prim zoj 1372 Networking
- ORA-00257:archiver error. Connect internal only, until freed.
- libvlc_media_add_option 函数中的参数设置
- URAL 1016. Cube on the Walk(搜索)比较难
- [转]Effective C++ 02 尽量以const, enum, inline替换#define 笔记
- 串口短信猫与USB短信猫
- python 网络编程
- php数据库操作类