JS——call(简单继承)
来源:互联网 发布:csol刷芯片软件 编辑:程序博客网 时间:2024/06/13 10:11
function Parent(name,money){this.name = name;this.money = money;this.info = function(){console.log("姓名:"+this.name+"钱:"+this.money);}}function Children(name){Parent.call(this,name); //简单继承this.info = function(){console.log("姓名:"+this.name);}}var per = new Parent("parent",10000); var chi = new Children("child");per.info(); //姓名:parent钱:10000chi.info(); //姓名:child
function Parent(name,money){this.name = name;this.money = money;this.info = function(){console.log("姓名:"+this.name+"钱:"+this.money);}}function Children(name,money){Parent.call(this,name,money); //简单继承/*this.info = function(){console.log("姓名:"+this.name);}*/}var per = new Parent("parent",10000); var chi = new Children("child",20000);per.info(); //姓名:parent钱:10000chi.info(); //姓名:child钱:20000
function Parent(name,money){this.name = name;this.money = money;this.info = function(){console.log("姓名:"+this.name+"钱:"+this.money);}}function Children(name,money){Parent.call(this,name,money); //简单继承/*this.info = function(){console.log("姓名:"+this.name);}*/this.info1 = function(){console.log("info1");}}var per = new Parent("parent",10000); var chi = new Children("child",20000);per.info(); //姓名:parent钱:10000chi.info(); //姓名:child钱:20000chi.info1(); //info1
-------------------------------------------------------------------------------------
window.color = "red";var o = {color:"blue"};function sayColor(){console.log(this.color);}sayColor(); //redsayColor.call(this);//redsayColor.call(window); //redsayColor.call(o); //blue
阅读全文
0 0
- JS——call(简单继承)
- JS CAll 继承
- js继承 call apply
- call apply js 继承
- JS——call
- js 采用call实现继承
- js call 方法简单介绍
- JS的Call方法实现的继承
- JS继承之巧用call()方法
- js中call()函数实现继承
- JS使用call函数实现继承
- 关于js中使用call实现继承
- js面向对象的继承实例-call
- js 面向对象的简单使用——继承
- 使用JS中的Call方法实现继承和多重继承
- js笔记——call,apply
- js call方法详细介绍(js 的继承)
- #笔记#圣思园 JavaWeb 第57讲——JS继承:对象冒充、call方法、apply方法、原型链方式、混合方式
- ZooKeeper之Java客户端API使用—创建节点。
- 事件监听
- 微信数据库转子http://blog.csdn.net/qq_24531461/article/details/77624255项目在https://github.com/1998lixin/WeCh
- 关于CyclicBarrier用法介绍
- sprintf用法解析
- JS——call(简单继承)
- 鼠标各键对应的ASCII码值
- 卷1部分4-8章
- Android 编程下 Touch 事件的分发和消费机制
- Python-Plot小记
- 列表样式
- android App大小大幅度减小
- Eclipse中jsp、js文件编辑时,卡死现象解决汇总
- Java代码在指定目录下运行DOS命令