{"id":6094,"date":"2025-12-24T14:03:32","date_gmt":"2025-12-24T06:03:32","guid":{"rendered":"https:\/\/blog.qdac.cc\/?p=6094"},"modified":"2025-12-24T14:05:19","modified_gmt":"2025-12-24T06:05:19","slug":"%e6%95%99%e7%a8%8b%e5%a6%82%e6%9e%9c%e5%b0%86%e4%b8%80%e4%b8%aa%e6%8e%a5%e5%8f%a3%e8%bd%ac%e6%8d%a2%e4%b8%ba%e6%b2%a1%e6%9c%89%e6%8e%a5%e5%8f%a3id%e7%9a%84%e6%8e%a5%e5%8f%a3%e5%ae%9a%e4%b9%89","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=6094","title":{"rendered":"[\u6559\u7a0b]\u8f6c\u6362\u6ca1\u6709\u5b9a\u4e49IID\u63a5\u53e3"},"content":{"rendered":"\n<p>\u4e00\u822c\u6765\u8bf4\uff0c\u6211\u4eec\u5b9a\u4e49\u63a5\u53e3\u90fd\u4f1a\u540c\u65f6\u4e3a\u63a5\u53e3\u5b9a\u4e49\u4e00\u4e2aGUID\u503c\uff0c\u4ee5\u4fbf\u80fd\u591f\u80fd\u591f\u901a\u8fc7 QueryInterface \u6216 Supports \u7b49\u51fd\u6570\u6765\u8fdb\u884c\u63a5\u53e3\u95f4\u7684\u8f6c\u6362\u3002\u4f46\u5982\u679c\u4e00\u4e2a\u672a\u5b9a\u4e49\u63a5\u53e3ID\u7684\u63a5\u53e3\uff0cQueryInterface\/Supports \u7531\u4e8e\u90fd\u9700\u8981\u63a5\u53e3 GUID\uff0c \u8bb8\u591a\u65f6\u5019\u5c31\u65e0\u80fd\u4e3a\u529b\u4e86\u3002<\/p>\n\n\n\n<p>\u5bf9\u4e8e\u8fd9\u79cd\u60c5\u51b5\uff0c\u5b9e\u9645\u4e0a\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u5c06\u63a5\u53e3\u8f6c\u6362\u4e3a\u63a5\u53e3\u5b9e\u73b0\u7684\u7c7b\uff0c\u7136\u540e\u518d\u8d4b\u503c\u7ed9\u76ee\u6807\u6765\u89e3\u51b3\u3002\u793a\u4f8b\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>type\n\nINoIdInterface=interface\n  function GetId:Integer;\nend;\n\nTNoIdObject=class(TInterfacedObject,INoIdInterface)\n...\nend;\n\nfunction GetNoIdInterface(const AIntf:IInterface):INoIdInterface;\nvar\n  AObj:TObject;\nbegin\n  AObj:= AIntf as TObject;\n  if AObj is TNoIdObject then\n    Result:=TNoIdObject(AObj)\n  else\n    Result:=nil;\nend;<\/code><\/pre>\n\n\n\n<p>\u672c\u8d28\u4e0a\u627e\u5230\u5176\u58f0\u660e\u7684\u7c7b\u578b\uff0c\u7136\u540e\u518d\u8f6c\u6362\u6210\u5bf9\u5e94\u7684\u7c7b\u578b\u518d\u8d4b\u7ed9\u63a5\u53e3\u5bf9\u8c61\u6765\u89e3\u51b3\u3002<\/p>\n\n\n\n<p>\u5f53\u7136\uff0c\u5982\u679c TNoIdObject \u5e76\u6ca1\u6709\u5728 interface \u91cc\u627e\u5230\uff0c\u90a3\u4e48\u6211\u4eec\u5c31\u9700\u8981\u989d\u5916\u7684\u6280\u5de7\uff0c\u6709\u5174\u8da3\u7684\u53ef\u4ee5\u81ea\u884c\u7814\u7a76\u4e0b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u822c\u6765\u8bf4\uff0c\u6211\u4eec\u5b9a\u4e49\u63a5\u53e3\u90fd\u4f1a\u540c\u65f6\u4e3a\u63a5\u53e3\u5b9a\u4e49 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[8,603],"tags":[847,74,47],"class_list":["post-6094","post","type-post","status-publish","format-standard","hentry","category-delphi","category-603","tag-iid","tag-74","tag-47"],"views":232,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/6094","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6094"}],"version-history":[{"count":3,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/6094\/revisions"}],"predecessor-version":[{"id":6097,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/6094\/revisions\/6097"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}