js对象继承,能复制父类属性以及方法,访问父类方法,创建私有成员

前端之家收集整理的这篇文章主要介绍了js对象继承,能复制父类属性以及方法,访问父类方法,创建私有成员前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

<table class="javascript"><tr class="li1">
<td class="ln"><pre class="de1">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

Rectanglelength width     . length     . width     Rectangle..     . . Rectangle..     . .   Squaresize     Rectangle. size size 父类传参,获取父类属性     privateMember       .         console.privateMember       父类的方法 函数,不用担心不加参数调用构造函数导致错误 方法做的事情类似,并且还能设置属性可读可枚举可写等特性。 Square. .Rectangle.     constructor         configurable         enumrable         value Square         writable       Square..     text Rectangle... 调用父类方法     text.   square Square console.square. console.square. console.square. console.square. console.square.

猜你在找的程序笔记相关文章