{"id":246416,"date":"2020-12-19T07:44:12","date_gmt":"2020-12-18T23:44:12","guid":{"rendered":"http:\/\/4563.org\/?p=246416"},"modified":"2020-12-19T07:44:12","modified_gmt":"2020-12-18T23:44:12","slug":"js-%e5%8e%9f%e5%9e%8b%e4%b8%8e%e5%8e%9f%e5%9e%8b%e9%93%be%e7%bb%a7%e6%89%bf%e7%9a%84%e5%85%b3%e7%b3%bb%e6%9c%89%e7%82%b9%e6%b2%a1%e6%87%82","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=246416","title":{"rendered":"js \u539f\u578b\u4e0e\u539f\u578b\u94fe\u7ee7\u627f\u7684\u5173\u7cfb\u6709\u70b9\u6ca1\u61c2"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  js \u539f\u578b\u4e0e\u539f\u578b\u94fe\u7ee7\u627f\u7684\u5173\u7cfb\u6709\u70b9\u6ca1\u61c2               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : cwz346852114 <\/span>  <span><i><\/i> 2<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>class Person{<\/p>\n<p>}<\/p>\n<p>class Child extends Person{ xxx()\uff5b<\/p>\n<pre><code>\uff5d <\/code><\/pre>\n<p>} class \u4e2d \u65b9\u6cd5\u662f\u7ed1\u5b9a\u5728\u8be5\u7c7b\u7684\u539f\u578b\u4e0a Person \u662f Child \u7684\u539f\u578b \u4e3a\u5565 Person \u5b9e\u4f8b\u5316\u5bf9\u8c61\u65e0\u6cd5\u8c03\u7528 Child \u4e0a\u7684 XXX \u65b9\u6cd5 \u6709\u54ea\u4e2a\u5927\u4f6c\u89e3\u91ca\u4e00\u4e0b \u611f\u89c9\u662f\u6211\u6ca1\u5f04\u61c2 \u7ee7\u627f\u7684\u95ee\u9898\u3002\u3002\u3002<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>11<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4801896\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : cwz346852114 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             111                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4801897\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : cwz346852114 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             111222                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4801898\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : cwz346852114 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             Object.getPrototypeOf(child)\u7684\u65f6\u5019\u8fd4\u56de\u7684\u539f\u578b\u662f Person \u6211\u5728 Person \u4e0a\u9762\u4e5f\u627e\u5230\u4e86 xxx \u8fd9\u4e2a\u65b9\u6cd5 \u4e3a\u5565\u7236\u7ea7\u76f4\u63a5\u6ca1\u6cd5\u8c03\u7528                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4801899\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : murmur <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u662f\u6211\u51fa\u73b0\u5e7b\u89c9\u4e86\u4e48\uff0cchild \u7ee7\u627f person\uff0c\u4e5f\u5e94\u8be5\u8bf4 child \u7684\u5b9e\u4f8b\u8c03\u7528 person \u7684\u65b9\u6cd5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4801900\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : murmur <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             class Person{<br \/> test1(params) {<br \/> console.log(111);<br \/> }<br \/>}<\/p>\n<p>class Child extends Person{<br \/> test2(params) {<br \/> console.log(222);<br \/> }<br \/>}<\/p>\n<p>var c = new Child();<\/p>\n<p>c.test2();<br \/>c.test1();<\/p>\n<p>\u8fd9\u6837\u662f\u6ca1\u95ee\u9898\u7684                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4801901\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : cwz346852114 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @murmur \u6211\u7684\u610f\u601d\u662f \u7236\u7ea7\u5b9e\u4f8b\u5316\u5bf9\u8c61 \u8c03\u7528\u5b50\u96c6\u91cc\u9762\u7684 xxx \u65b9\u6cd5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4801902\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : murmur <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @cwz346852114 \u4f60\u53bb\u770b\u770b\u9762\u5411\u5bf9\u8c61\u7684\u601d\u8def\uff0c\u90fd\u662f\u5b50\u7c7b\u8bbf\u95ee\u7236\u7c7b\u7684\u65b9\u6cd5\uff0c\u6211\u8fd8\u6ca1\u542c\u8bf4\u8fc7\u7236\u7c7b\u8bbf\u95ee\u5b50\u7c7b\u7684\u65b9\u6cd5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4801903\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : YuxiangLuo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f46\u51e1\u4f60\u5b66\u8fc7\u4e00\u70b9\u9762\u5411\u5bf9\u8c61\u7f16\u7a0b\u4e5f\u95ee\u4e0d\u51fa\u8fd9\u4e48\u4e0d\u7740\u8fb9\u9645\u7684\u95ee\u9898\uff0c\u5dee\u7684\u77e5\u8bc6\u592a\u591a\u4e86\uff0c\u5148\u770b\u770b\u57fa\u7840\u5427                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4801904\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zengzizhao <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53bb\u770b\u770b C++\u91cc\u7684\u9762\u5411\u5bf9\u8c61\uff0c\u4ece\u5185\u5b58\u65b9\u9762\u4e86\u89e3\u4e00\u4e0b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4801905\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yanguoyu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u96be\u9053\u8981\u95ee\u7684\u662f\u7c7b\u4f3c C++\u7684\u865a\u51fd\u6570\uff0c\u7236\u7c7b\u6307\u9488\u8c03\u7528\u5b50\u7c7b\u65b9\u6cd5?                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4801906\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Zhuzhuchenyan <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5e2e\u4f60\u5206\u6790\u4e0b<br \/>&gt; class Person {}<br \/>&gt; class Child extends Person {test(){}}<\/p>\n<p>&gt; Child.prototype.hasOwnProperty(&#8216;test&#8217;)<br \/>True<\/p>\n<p>&gt; let aChild = new Child()<br \/>&gt; aChild.__proto__ === Child.prototype<br \/>True<\/p>\n<p>&gt; aChild.__proto__.__proto__ === Person.prototype<br \/>True<\/p>\n<p>\u8fd9\u624d\u662f\u8fd9\u6839\u539f\u578b\u94fe\u7684\u672c\u6765\u9762\u8c8c\uff0c\u66f4\u5177\u4f53\u7684\uff0c\u5bf9 Person \u7684\u5b9e\u4f8b\u5316\u5bf9\u8c61\u800c\u8a00<br \/>&gt; let aPerson = new Person()<br \/>&gt; aPerson.__proto__ === Person.prototype<br \/>True<\/p>\n<p>aPerson \u7684\u539f\u578b\u94fe\u4e2d\u8df3\u8fc7\u4e86\u4e00\u4e2a\u73af\u8282\uff0c\u5c06 Child.prototype \u8df3\u8fc7\u4e86\uff0c\u4ece\u800c aPerson \u4e2d\u7684\u539f\u578b\u94fe\u4e2d\u4e0d\u53ef\u80fd\u6709 test \u65b9\u6cd5\u3002<br \/>\u6269\u5c55\u9605\u8bfb<br \/>https:\/\/developer.mozilla.org\/zh-CN\/docs\/Web\/JavaScript\/Inheritance_and_the_prototype_chain                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>js \u539f\u578b\u4e0e\u539f\u578b\u94fe\u7ee7\u627f\u7684\u5173\u7cfb\u6709\u70b9\u6ca1&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/246416"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=246416"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/246416\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=246416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=246416"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=246416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}