{"id":694,"date":"2026-07-15T12:22:16","date_gmt":"2026-07-15T04:22:16","guid":{"rendered":"https:\/\/mitongxue.cn\/?p=694"},"modified":"2026-07-15T12:22:16","modified_gmt":"2026-07-15T04:22:16","slug":"%e5%90%84%e8%af%ad%e8%a8%80%e9%9d%a2%e5%90%91%e5%af%b9%e8%b1%a1%e5%ba%95%e5%b1%82%e5%ae%9e%e7%8e%b0%e6%96%b9%e6%a1%88","status":"publish","type":"post","link":"https:\/\/mitongxue.cn\/index.php\/2026\/07\/15\/%e5%90%84%e8%af%ad%e8%a8%80%e9%9d%a2%e5%90%91%e5%af%b9%e8%b1%a1%e5%ba%95%e5%b1%82%e5%ae%9e%e7%8e%b0%e6%96%b9%e6%a1%88\/","title":{"rendered":"\u5404\u8bed\u8a00\u9762\u5411\u5bf9\u8c61\u5e95\u5c42\u5b9e\u73b0\u65b9\u6848"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u4e00\u3001JAVA\uff1a\u57fa\u4e8e<strong>\u7c7b\u6a21\u677f + \u5355\u6839\u7c7b\u5c42\u6b21 + \u865a\u65b9\u6cd5\u8868 vtable<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">1. <strong>\u7c7b\u662f\u9759\u6001\u6a21\u677f<\/strong> \u7f16\u8bd1\u671f <code>class<\/code> \u751f\u6210 <code>.class<\/code> \u5b57\u8282\u7801\uff0c\u7c7b\u7ed3\u6784\u56fa\u5b9a\uff1b\u6240\u6709\u5b9e\u4f8b\u6839\u636e\u7c7b\u6a21\u677f\u521b\u5efa\uff0c\u6bcf\u4e2a\u5b9e\u4f8b\u4fdd\u5b58<strong>\u5b9e\u4f8b\u5b57\u6bb5<\/strong>\uff0c\u65b9\u6cd5\u3001\u9759\u6001\u53d8\u91cf\u3001\u5e38\u91cf\u5b58\u5728\u7c7b\u5bf9\u8c61\uff08<code>Class<\/code>\uff09\u4e2d\u5171\u4eab\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2. <strong>\u5355\u6839\u7ee7\u627f<\/strong>\uff1a\u6240\u6709\u7c7b\u9690\u5f0f\u7ee7\u627f <code>Object<\/code>\uff0c\u53ea\u652f\u6301\u5355\u7c7b\u7ee7\u627f\u3001\u591a\u63a5\u53e3\u5b9e\u73b0\u3002 <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3. <strong>\u65b9\u6cd5\u5206\u53d1\uff1a\u865a\u65b9\u6cd5\u8868 vtable<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u6bcf\u4e2a\u7c7b\u52a0\u8f7d\u65f6\u751f\u6210\u4e00\u5f20\u865a\u51fd\u6570\u8868\uff0c\u5b58\u653e\u91cd\u5199\u540e\u7684\u65b9\u6cd5\u6307\u9488\uff1b<\/li>\n\n\n\n<li>\u8c03\u7528\u5b9e\u4f8b\u65b9\u6cd5\u65f6\uff0c\u901a\u8fc7\u5bf9\u8c61\u5934\u627e\u5230\u7c7b\u7684 vtable\uff0c\u67e5\u8868\u6267\u884c\u5bf9\u5e94\u65b9\u6cd5\uff0c\u5b9e\u73b0\u591a\u6001\u3002<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">4. <strong>\u5c5e\u6027\u67e5\u627e<\/strong>\uff1a\u7f16\u8bd1\u671f\u786e\u5b9a\u5b57\u6bb5\u504f\u79fb\u91cf\uff0c\u8fd0\u884c\u65f6\u76f4\u63a5\u5185\u5b58\u504f\u79fb\u53d6\u503c\uff0c\u65e0\u52a8\u6001\u94fe\u5f0f\u67e5\u627e\uff1b\u5b50\u7c7b\u5b57\u6bb5\u4e0e\u7236\u7c7b\u5b57\u6bb5\u5206\u79bb\uff0c\u4e0d\u5b58\u5728 JS \u539f\u578b\u94fe\u90a3\u79cd\u52a8\u6001\u9010\u7ea7\u67e5\u627e\u3002 <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">5. <strong>\u63a5\u53e3<\/strong>\uff1a\u65e0\u72b6\u6001\uff0c\u4ec5\u5b9a\u4e49\u65b9\u6cd5\u7b7e\u540d\uff0c\u4e0d\u5b58\u50a8\u5b57\u6bb5\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5bf9\u6bd4 JS \u539f\u578b\u94fe<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Java \u662f<strong>\u7c7b\u5148\u884c<\/strong>\uff1a\u5148\u6709\u5b8c\u6574\u7c7b\u5b9a\u4e49\uff0c\u624d\u80fd new \u5bf9\u8c61\uff1bJS \u662f<strong>\u539f\u578b\u5148\u884c<\/strong>\uff0c\u5bf9\u8c61\u53ef\u4ee5\u76f4\u63a5\u521b\u5efa\u518d\u6302\u8f7d\u539f\u578b\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e8c\u3001Go\uff1a\u65e0\u7c7b\u3001\u65e0\u7ee7\u627f\uff0c\u91c7\u7528<strong>\u7ed3\u6784\u4f53 struct + \u5d4c\u5165\u7ec4\u5408 + \u63a5\u53e3\u9e2d\u5b50\u7c7b\u578b<\/strong>\uff08\u7ec4\u5408\u4f18\u4e8e\u7ee7\u627f\uff09<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Go \u5f7b\u5e95\u629b\u5f03\u4f20\u7edf class \u7ee7\u627f\u4f53\u7cfb\uff0c\u6ca1\u6709 \u201c\u7c7b\u201d \u8fd9\u4e2a\u8bed\u6cd5\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>struct \u5145\u5f53\u6570\u636e\u8f7d\u4f53<\/strong> <code>type User struct { name string }<\/code> \u66ff\u4ee3\u7c7b\uff0c\u4ec5\u4fdd\u5b58\u5b57\u6bb5\uff1b\u65b9\u6cd5\u901a\u8fc7 <code>func (u User) Say(){}<\/code> \u7ed1\u5b9a\u5230\u7ed3\u6784\u4f53\u3002<\/li>\n\n\n\n<li><strong>\u5d4c\u5165\u7ec4\u5408\u66ff\u4ee3\u7ee7\u627f<\/strong> go\u8fd0\u884c<code>type Person struct { name string } type Student struct { Person \/\/ \u533f\u540d\u5d4c\u5165\uff0c\u590d\u7528\u5b57\u6bb5\u4e0e\u65b9\u6cd5\uff0c\u8bed\u6cd5\u7cd6\uff0c\u975e\u7ee7\u627f score float64 }<\/code> \u53ea\u662f\u8bed\u6cd5\u8f6c\u53d1\uff0c\u4e0d\u5b58\u5728\u7236\u7c7b \/ \u5b50\u7c7b\u5c42\u7ea7\uff0c\u6ca1\u6709 MRO\u3001\u6ca1\u6709 vtable\u3002<\/li>\n\n\n\n<li><strong>\u9690\u5f0f\u63a5\u53e3\uff08\u9e2d\u5b50\u7c7b\u578b\uff09<\/strong> \u53ea\u8981\u7ed3\u6784\u4f53\u62e5\u6709\u63a5\u53e3\u5168\u90e8\u65b9\u6cd5\uff0c\u81ea\u52a8\u5b9e\u73b0\u8be5\u63a5\u53e3\uff0c\u65e0\u9700\u663e\u5f0f <code>implements<\/code>\uff1b \u63a5\u53e3\u5e95\u5c42\u9760 <code>itab<\/code> \u5b58\u50a8\u7c7b\u578b\u4e0e\u65b9\u6cd5\u6620\u5c04\u8868\u5b9e\u73b0\u591a\u6001\u5206\u53d1\u3002<\/li>\n\n\n\n<li>\u65e0\u7236\u7c7b\u3001\u65e0\u591a\u6001\u7ee7\u627f\u3001\u65e0\u6784\u9020\u51fd\u6570\uff0c\u9760\u7ec4\u5408\u590d\u7528\u4ee3\u7801\u3002<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e09\u3001PHP\uff1a\u57fa\u4e8e\u7c7b\u6a21\u677f\uff0c\u5355\u7ee7\u627f\uff0c\u52a8\u6001\u5c5e\u6027 + \u65b9\u6cd5\u67e5\u627e\uff0c\u8fd1\u4f3c Java \u4f46\u9ad8\u5ea6\u52a8\u6001<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>class \u7c7b\u6a21\u677f\u6a21\u578b<\/strong>\uff08\u548c Java \u540c\u5c5e\u57fa\u4e8e\u7c7b\uff09 \u4ee3\u7801 <code>class User{}<\/code> \u5b9a\u4e49\u7c7b\u6a21\u677f\uff0c\u5b9e\u4f8b\u5b58\u50a8\u72ec\u6709\u5c5e\u6027\uff0c\u7c7b\u5b58\u50a8\u9759\u6001\u6210\u5458\u3001\u65b9\u6cd5\u3002<\/li>\n\n\n\n<li><strong>\u5355\u7c7b\u7ee7\u627f\u3001\u591a\u63a5\u53e3<\/strong>\uff0c\u7236\u7c7b\u65b9\u6cd5\u901a\u8fc7 <code>parent::<\/code> \u8c03\u7528\uff0c\u7ee7\u627f\u94fe\u56fa\u5b9a\u3002<\/li>\n\n\n\n<li>\u533a\u522b Java\uff1aPHP \u662f<strong>\u52a8\u6001\u5f31\u7c7b\u578b<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u5b9e\u4f8b\u53ef\u52a8\u6001\u65b0\u589e\u5c5e\u6027\uff08<code>$u->test = 1<\/code>\uff09\uff1b<\/li>\n\n\n\n<li>\u652f\u6301\u9b54\u672f\u65b9\u6cd5 <code>__get\/__set\/__call<\/code> \u62e6\u622a\u5c5e\u6027 \/ \u65b9\u6cd5\u8bbf\u95ee\uff0c\u8fd0\u884c\u65f6\u52a8\u6001\u5904\u7406\uff1b<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u591a\u6001\u5206\u53d1\uff1aZend \u5f15\u64ce\u4e3a\u6bcf\u4e2a\u7c7b\u7ef4\u62a4\u65b9\u6cd5\u54c8\u5e0c\u8868\uff0c\u8fd0\u884c\u65f6\u67e5\u8868\u8c03\u7528\uff0c\u65e0\u7f16\u8bd1\u671f\u56fa\u5b9a vtable\uff1b<\/li>\n\n\n\n<li>\u65e0\u539f\u578b\u94fe\uff0c\u7ee7\u627f\u662f\u7f16\u8bd1 \/ \u89e3\u6790\u9636\u6bb5\u786e\u5b9a\u7684\u7c7b\u5c42\u7ea7\uff0c\u4e0d\u662f\u5bf9\u8c61\u4e4b\u95f4\u7684\u539f\u578b\u5f15\u7528\u94fe\u3002<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-center\" data-align=\"center\">\u8bed\u8a00<\/th><th class=\"has-text-align-center\" data-align=\"center\">OO \u6838\u5fc3\u65b9\u6848<\/th><th class=\"has-text-align-center\" data-align=\"center\">\u7ee7\u627f\u65b9\u5f0f<\/th><th class=\"has-text-align-center\" data-align=\"center\">\u591a\u6001\u5b9e\u73b0<\/th><th class=\"has-text-align-center\" data-align=\"center\">\u52a8\u6001\u7279\u6027<\/th><\/tr><\/thead><tbody><tr><td>Java<\/td><td>\u9759\u6001\u7c7b\u6a21\u677f vtable<\/td><td>\u5355\u7c7b\u7ee7\u627f + \u591a\u63a5\u53e3<\/td><td>\u7f16\u8bd1\u671f\u865a\u65b9\u6cd5\u8868<\/td><td>\u5f31\u52a8\u6001\uff0c\u5b57\u6bb5\u56fa\u5b9a<\/td><\/tr><tr><td>PHP<\/td><td>\u52a8\u6001\u7c7b\u6a21\u677f \u65b9\u6cd5\u54c8\u5e0c\u8868<\/td><td>\u5355\u7c7b\u7ee7\u627f + \u591a\u63a5\u53e3<\/td><td>\u8fd0\u884c\u65f6\u65b9\u6cd5\u54c8\u5e0c\u67e5\u627e<\/td><td>\u5f3a\u52a8\u6001\uff0c\u652f\u6301\u9b54\u672f\u65b9\u6cd5\u3001\u52a8\u6001\u5c5e\u6027<\/td><\/tr><tr><td>Python<\/td><td>\u7c7b + \u5143\u7c7b type+MRO<\/td><td>\u591a\u7ee7\u627f MRO<\/td><td>\u8fd0\u884c\u65f6\u5c5e\u6027\u5b57\u5178\u3001MRO \u904d\u5386<\/td><td>\u6781\u81f4\u52a8\u6001\uff0c\u53ef\u8fd0\u884c\u65f6\u589e\u5220\u7c7b \/ \u5b9e\u4f8b\u5c5e\u6027<\/td><\/tr><tr><td>Go<\/td><td>struct \u7ec4\u5408 + itab \u63a5\u53e3<\/td><td>\u65e0\u7ee7\u627f\uff0c\u4ec5\u5d4c\u5165\u7ec4\u5408<\/td><td>\u63a5\u53e3 itab \u67e5\u8868<\/td><td>\u4e2d\u7b49\u52a8\u6001\uff0c\u65e0\u52a8\u6001\u5b57\u6bb5\u9b54\u672f\u65b9\u6cd5<\/td><\/tr><tr><td>JS<\/td><td>\u539f\u578b\u94fe Prototype<\/td><td>\u539f\u578b\u59d4\u6258\uff08\u65e0\u7c7b\u7ee7\u627f\uff09<\/td><td>\u9010\u7ea7__proto__\u67e5\u627e<\/td><td>\u6781\u81f4\u52a8\u6001\uff0c\u539f\u578b\u53ef\u968f\u65f6\u4fee\u6539<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001JAVA\uff1a\u57fa\u4e8e\u7c7b\u6a21\u677f + \u5355\u6839\u7c7b\u5c42\u6b21 + \u865a\u65b9..<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53,15,16,18,55,52,14],"tags":[],"class_list":["post-694","post","type-post","status-publish","format-standard","hentry","category-go","category-java","category-js","category-nodejs","category-php","category-python","category-back"],"featured_image_urls":{"full":"","thumbnail":"","medium":"","medium_large":"","large":"","1536x1536":"","2048x2048":""},"author_info":{"info":["\u9648 \u67d0\u4eba"]},"category_info":"<a href=\"https:\/\/mitongxue.cn\/index.php\/category\/back\/go\/\" rel=\"category tag\">Go<\/a> <a href=\"https:\/\/mitongxue.cn\/index.php\/category\/back\/java\/\" rel=\"category tag\">Java<\/a> <a href=\"https:\/\/mitongxue.cn\/index.php\/category\/front\/js\/\" rel=\"category tag\">JS<\/a> <a href=\"https:\/\/mitongxue.cn\/index.php\/category\/back\/nodejs\/\" rel=\"category tag\">NodeJS<\/a> <a href=\"https:\/\/mitongxue.cn\/index.php\/category\/back\/php\/\" rel=\"category tag\">PHP<\/a> <a href=\"https:\/\/mitongxue.cn\/index.php\/category\/back\/python\/\" rel=\"category tag\">Python<\/a> <a href=\"https:\/\/mitongxue.cn\/index.php\/category\/back\/\" rel=\"category tag\">\u540e\u7aef<\/a>","tag_info":"\u540e\u7aef","comment_count":"0","_links":{"self":[{"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/posts\/694","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/comments?post=694"}],"version-history":[{"count":1,"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/posts\/694\/revisions"}],"predecessor-version":[{"id":695,"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/posts\/694\/revisions\/695"}],"wp:attachment":[{"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/media?parent=694"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/categories?post=694"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mitongxue.cn\/index.php\/wp-json\/wp\/v2\/tags?post=694"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}