{"id":38956,"date":"2023-12-11T14:45:59","date_gmt":"2023-12-11T06:45:59","guid":{"rendered":"https:\/\/wx.kaifamiao.info\/?p=38956"},"modified":"2023-12-11T14:45:59","modified_gmt":"2023-12-11T06:45:59","slug":"%e8%af%b7%e4%bd%a0%e8%af%b4%e8%af%b4static-nested-class-%e5%92%8c-inner-class%e7%9a%84%e4%b8%8d%e5%90%8c","status":"publish","type":"post","link":"http:\/\/wx.kaifamiao.info\/index.php\/2023\/12\/11\/%e8%af%b7%e4%bd%a0%e8%af%b4%e8%af%b4static-nested-class-%e5%92%8c-inner-class%e7%9a%84%e4%b8%8d%e5%90%8c\/","title":{"rendered":"\u8bf7\u4f60\u8bf4\u8bf4Static Nested Class \u548c Inner Class\u7684\u4e0d\u540c"},"content":{"rendered":"<p>&#8220;`&#8221;                    \u8003\u5bdf\u70b9\uff1a\u58f0\u660e<\/p>\n<p>Static Nested Class\u662f\u88ab\u58f0\u660e\u4e3a\u9759\u6001\uff08static\uff09\u7684\u5185\u90e8\u7c7b\uff0c\u5b83\u53ef\u4ee5\u4e0d\u4f9d\u8d56\u4e8e\u5916\u90e8\u7c7b\u5b9e\u4f8b\u88ab\u5b9e\u4f8b\u5316\u3002\u800c\u901a\u5e38\u7684\u5185\u90e8\u7c7b\u9700\u8981\u5728\u5916\u90e8\u7c7b\u5b9e\u4f8b\u5316\u540e\u624d\u80fd\u5b9e\u4f8b\u5316\u3002Static-Nested Class \u7684\u6210\u5458, \u65e2\u53ef\u4ee5\u5b9a\u4e49\u4e3a\u9759\u6001\u7684(static), \u4e5f\u53ef\u4ee5\u5b9a\u4e49\u4e3a\u52a8\u6001\u7684(instance).Nested Class\u7684\u9759\u6001\u6210\u5458(Method)\u53ea\u80fd\u5bf9Outer Class\u7684\u9759\u6001\u6210\u5458(static memebr)\u8fdb\u884c\u64cd\u4f5c(ACCESS), \u800c\u4e0d\u80fdAccess Outer Class\u7684\u52a8\u6001\u6210\u5458(instance member).\u800c Nested Class\u7684\u52a8\u6001\u6210\u5458(instance method) \u5374\u53ef\u4ee5 Access Outer Class\u7684\u6240\u6709\u6210\u5458, \u8fd9\u4e2a\u6982\u5ff5\u5f88\u91cd\u8981, \u8bb8\u591a\u4eba\u5bf9\u8fd9\u4e2a\u6982\u5ff5\u6a21\u7cca. \u6709\u4e00\u4e2a\u666e\u901a\u7684\u539f\u5219, \u56e0\u4e3a\u9759\u6001\u65b9\u6cd5(static method) \u603b\u662f\u8ddf CLASS \u76f8\u5173\u8054(bind CLASS), \u800c\u52a8\u6001\u65b9\u6cd5( (instance method) \u603b\u662f\u8ddf instance object \u76f8\u5173\u8054, \u6240\u4ee5,\u9759\u6001\u65b9\u6cd5(static method)\u6c38\u8fdc\u4e0d\u53ef\u4ee5Access\u8ddf object \u76f8\u5173\u7684\u52a8\u6001\u6210\u5458(instance member),\u53cd\u8fc7\u6765\u5c31\u53ef\u4ee5, \u4e00\u4e2aCLASS\u7684 instance object \u53ef\u4ee5 Access \u8fd9\u4e2a Class \u7684\u4efb\u4f55\u6210\u5458, \u5305\u62ec\u9759\u6001\u6210\u5458(static member).<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0&lt;\/p&gt;<\/p>\n<p>&lt;h2&gt;\u8bf7\u4f60\u8bb2\u8bb2abstract class\u548cinterface\u6709\u4ec0\u4e48\u533a\u522b?&lt;\/h2&gt;<\/p>\n<p>\u8003\u5bdf\u70b9\uff1a\u62bd\u8c61\u7c7b<\/p>\n<p>\u58f0\u660e\u65b9\u6cd5\u7684\u5b58\u5728\u800c\u4e0d\u53bb\u5b9e\u73b0\u5b83\u7684\u7c7b\u88ab\u53eb\u505a\u62bd\u8c61\u7c7b\uff08abstract class\uff09\uff0c\u5b83\u7528\u4e8e\u8981\u521b\u5efa\u4e00\u4e2a\u4f53\u73b0\u67d0\u4e9b\u57fa\u672c\u884c\u4e3a\u7684\u7c7b\uff0c\u5e76\u4e3a\u8be5\u7c7b\u58f0\u660e\u65b9\u6cd5\uff0c\u4f46\u4e0d\u80fd\u5728\u8be5\u7c7b\u4e2d\u5b9e\u73b0\u8be5\u7c7b\u7684\u60c5\u51b5\u3002\u4e0d\u80fd\u521b\u5efaabstract \u7c7b\u7684\u5b9e\u4f8b\u3002\u7136\u800c\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u53d8\u91cf\uff0c\u5176\u7c7b\u578b\u662f\u4e00\u4e2a\u62bd\u8c61\u7c7b\uff0c\u5e76\u8ba9\u5b83\u6307\u5411\u5177\u4f53\u5b50\u7c7b\u7684\u4e00\u4e2a\u5b9e\u4f8b\u3002\u4e0d\u80fd\u6709\u62bd\u8c61\u6784\u9020\u51fd\u6570\u6216\u62bd\u8c61\u9759\u6001\u65b9\u6cd5\u3002Abstract \u7c7b\u7684\u5b50\u7c7b\u4e3a\u5b83\u4eec\u7236\u7c7b\u4e2d\u7684\u6240\u6709\u62bd\u8c61\u65b9\u6cd5\u63d0\u4f9b\u5b9e\u73b0\uff0c\u5426\u5219\u5b83\u4eec\u4e5f\u662f\u62bd\u8c61\u7c7b\u4e3a\u3002\u53d6\u800c\u4ee3\u4e4b\uff0c\u5728\u5b50\u7c7b\u4e2d\u5b9e\u73b0\u8be5\u65b9\u6cd5\u3002\u77e5\u9053\u5176\u884c\u4e3a\u7684\u5176\u5b83\u7c7b\u53ef\u4ee5\u5728\u7c7b\u4e2d\u5b9e\u73b0\u8fd9\u4e9b\u65b9\u6cd5\u3002<\/p>\n<p>\u63a5\u53e3\uff08interface\uff09\u662f\u62bd\u8c61\u7c7b\u7684\u53d8\u4f53\u3002\u5728\u63a5\u53e3\u4e2d\uff0c\u6240\u6709\u65b9\u6cd5\u90fd\u662f\u62bd\u8c61\u7684\u3002\u591a\u7ee7\u627f\u6027\u53ef\u901a\u8fc7\u5b9e\u73b0\u8fd9\u6837\u7684\u63a5\u53e3\u800c\u83b7\u5f97\u3002\u63a5\u53e3\u4e2d\u7684\u6240\u6709\u65b9\u6cd5\u90fd\u662f\u62bd\u8c61\u7684\uff0c\u6ca1\u6709\u4e00\u4e2a\u6709\u7a0b\u5e8f\u4f53\u3002\u63a5\u53e3\u53ea\u53ef\u4ee5\u5b9a\u4e49static final\u6210\u5458\u53d8\u91cf\u3002\u63a5\u53e3\u7684\u5b9e\u73b0\u4e0e\u5b50\u7c7b\u76f8\u4f3c\uff0c\u9664\u4e86\u8be5\u5b9e\u73b0\u7c7b\u4e0d\u80fd\u4ece\u63a5\u53e3\u5b9a\u4e49\u4e2d\u7ee7\u627f\u884c\u4e3a\u3002\u5f53\u7c7b\u5b9e\u73b0\u7279\u6b8a\u63a5\u53e3\u65f6\uff0c\u5b83\u5b9a\u4e49\uff08\u5373\u5c06\u7a0b\u5e8f\u4f53\u7ed9\u4e88\uff09\u6240\u6709\u8fd9\u79cd\u63a5\u53e3\u7684\u65b9\u6cd5\u3002\u7136\u540e\uff0c\u5b83\u53ef\u4ee5\u5728\u5b9e\u73b0\u4e86\u8be5\u63a5\u53e3\u7684\u7c7b\u7684\u4efb\u4f55\u5bf9\u8c61\u4e0a\u8c03\u7528\u63a5\u53e3\u7684\u65b9\u6cd5\u3002\u7531\u4e8e\u6709\u62bd\u8c61\u7c7b\uff0c\u5b83\u5141\u8bb8\u4f7f\u7528\u63a5\u53e3\u540d\u4f5c\u4e3a\u5f15\u7528\u53d8\u91cf\u7684\u7c7b\u578b\u3002\u901a\u5e38\u7684\u52a8\u6001\u8054\u7f16\u5c06\u751f\u6548\u3002\u5f15\u7528\u53ef\u4ee5\u8f6c\u6362\u5230\u63a5\u53e3\u7c7b\u578b\u6216\u4ece\u63a5\u53e3\u7c7b\u578b\u8f6c\u6362\uff0cinstanceof \u8fd0\u7b97\u7b26\u53ef\u4ee5\u7528\u6765\u51b3\u5b9a\u67d0\u5bf9\u8c61\u7684\u7c7b\u662f\u5426\u5b9e\u73b0\u4e86\u63a5\u53e3\u3002<\/p>\n<p>&lt;pre&gt;&lt;code&gt;            &quot;&#8220;`<br \/>\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;`&#8221; \u8003\u5bdf\u70b9\uff1a\u58f0\u660e Static Nested Class\u662f\u88ab\u58f0\u660e\u4e3a\u9759\u6001\uff08stati [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-38956","post","type-post","status-publish","format-standard","hentry","category-c"],"_links":{"self":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/38956","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/comments?post=38956"}],"version-history":[{"count":1,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/38956\/revisions"}],"predecessor-version":[{"id":38957,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/38956\/revisions\/38957"}],"wp:attachment":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/media?parent=38956"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/categories?post=38956"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/tags?post=38956"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}