zoukankan
html css js c++ java
prototype理解
<
script
>
function
aa()
{
this
.x
=
5
;
this
.y
=
6
;
//
内部定义的函数只有实例化后才可以使用
this
.test
=
function
(a)
{
alert(a
+
"
,
"
+
this
.x
+
"
,
"
+
this
.y);
}
}
//
prototype定义的函数未实例化就可以取得指针
aa.prototype.pany
=
function
(a)
{
alert(a
+
"
,
"
+
this
.x);
}
alert(aa.test);
alert(aa.prototype.test);
alert(aa.pany);
alert(aa.prototype.pany);
window[
"
Hello
"
]
=
aa;
aa.prototype[
"
MyAlert
"
]
=
aa.prototype.pany;
var
xx
=
new
Hello();
xx.MyAlert(
"
0
"
);
xx.pany(
"
1
"
);
//
xx.test(
"
2
"
);
</
script
>
查看全文
相关阅读:
Codeforces Beta Round #25 (Div. 2 Only) D. Roads not only in Berland(DFS+并查集)
HDU 3473 Minimum Sum(划分树)
Oracle锁表与解锁 对象锁与解锁
Java实现多个客户端聊天程序
Javacript实现颜色渐变的效果
生成对象的模式(PHP)
C语言实现的简单通讯录例子
C语言实现加密通讯录雏形
TP中Model
php整合Apache
原文地址:https://www.cnblogs.com/panyee/p/386984.html
最新文章
POJ 1904 King's Quest(强连通分量)
POJ 2762 Going from u to v or from v to u?(半连通图)
POJ 2828 Buy Tickets(线段树)
Codeforces Round #170 (Div. 1) E. Binary Tree on Plane(最小费用流)
HDU 1251 统计难题(字典树)
HDU 3072 Intelligence System(强连通分量)
HDU 2222 Keywords Search(AC自动机)
Codeforces Beta Round #25 (Div. 2 Only) C. Roads in Berland(Floyd变形)
Codeforces Round #171 (Div. 2) C. Ladder(二分)
POJ 2186 Popular Cows(强连通分量)
热门文章
Codeforces Round #179 (Div. 1) B. Greg and Graph(Floyd 变形)
Codeforces Beta Round #22 (Div. 2 Only) E. Scheme(DFS+强连通)
HDU 1011 Starship Troopers(树上背包)
HDU 2767 Proving Equivalences(强连通分量)
HDU 1698 Just a Hook(线段树)
POJ 1236 Network of Schools(强连通分量)
POJ 2553 The Bottom of a Graph(强连通分量)
POJ 3177 Redundant Paths(边双连通分量)
POJ 3286 How many 0's?(数位统计)
HDU 2846 Repository(字典树)
Copyright © 2011-2022 走看看