{"id":6092,"date":"2025-12-23T22:00:16","date_gmt":"2025-12-23T14:00:16","guid":{"rendered":"https:\/\/blog.qdac.cc\/?p=6092"},"modified":"2025-12-23T22:00:16","modified_gmt":"2025-12-23T14:00:16","slug":"%e6%95%99%e7%a8%8b%e6%80%8e%e4%b9%88%e5%88%a4%e6%96%ad%e4%b8%80%e4%b8%aa%e5%bd%93%e5%89%8d%e7%b1%bb%e7%9a%84%e6%9f%90%e4%b8%aa%e5%87%bd%e6%95%b0%e6%98%af%e5%90%a6%e6%98%af%e7%ba%af%e8%99%9a%e5%87%bd","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=6092","title":{"rendered":"[\u6559\u7a0b]\u600e\u4e48\u5224\u65ad\u4e00\u4e2a\u5f53\u524d\u7c7b\u7684\u67d0\u4e2a\u51fd\u6570\u662f\u5426\u662f\u7eaf\u865a\u51fd\u6570"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u5728 Delphi \u4e2d\uff0c\u6240\u6709\u7eaf\u865a\u51fd\u6570\u7684\u4ee3\u7801\u90fd\u6307\u5411\u4e86 System._AbstractError\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u5b83\u5728\u57fa\u7c7b\u4e2d\u5224\u5b9a\u5b83\u662f\u5426\u5b50\u7c7b\u662f\u5426\u5b9e\u73b0\u4e86\u67d0\u4e2a\u63a5\u53e3\u3002\u4e0d\u8fc7\u9057\u61be\u7684\u662f\uff0cDelphi \u4e2d\uff0c_AbstractError \u7684\u5730\u5740\uff0c\u6211\u4eec\u5e76\u4e0d\u80fd\u76f4\u63a5\u7528 @System._AbstractError \u6765\u83b7\u53d6\u5730\u5740\uff0c\u6240\u4ee5\u6211\u4eec\u9700\u8981\u4e00\u70b9\u5c0f\u6280\u5de7\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>type\n  TAbstractHelper=class\n  protected\n  class var\n    FAbstractCode:Pointer;\n    procedure AbstractMethod;virtual;abstract;\n  public\n    class constructor Create;\n    class function IsAbstract&lt;T>(AEvent:T):Boolean;static;\n  end;\n\n{ TAbstractHelper }\nclass constructor TAbstractHelper.Create;\ntype\n  TMethodEvent=procedure of object;\nvar\n  AProc:TMethod;\n  AEvent:TMethodEvent absolute AProc;\nbegin\n  with TAbstractHelper.Create do\n  begin\n    AEvent:=AbstractMethod;\n    FAbstractCode:=aProc.Code;\n    Free;\n  end;\nend;\n\nclass function TAbstractHelper.IsAbstract&lt;T>(AEvent: T): Boolean;\nvar\n  AMethod:TMethod absolute AEvent;\nbegin\n  Result:=AMethod.Code=FAbstractCode;\nend;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u73b0\u5728\u6211\u4eec\u901a\u8fc7 TAbstractHelper.FAbstractCode \u5c31\u53d6\u5230\u4e86 System._AbstractError \u7684\u5730\u5740\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u63a5\u4e0b\u6765\u5c31\u662f\u5982\u4f55\u5b9e\u73b0\u5224\u65ad\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>TForm1=class(TForm)\n...\nprotected\n    procedure InternalLoadData;virtual;abstract;\n...\npublic\n    function SupportAutoload:Boolean;\nend;\n\nfunction TForm1.SupportAutoload: Boolean;\ntype\n  TInternalLoadDataEvent = procedure of object;\nbegin\n  Result:=TAbstractHelper.IsAbstract&lt;TInternalLoadDataEvent>(InternalLoadData);\nend;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u9762\u7684\u4ee3\u7801\uff0cTForm1 \u672c\u8eab InternalLoaData \u662f\u7eaf\u865a\u51fd\u6570\uff0cSupportAutoload \u4f1a\u8fd4\u56de false\uff0c\u800c\u5982\u679c\u5b50\u7c7b\u5b9e\u73b0\u4e86 InternalLoadData \u7ed3\u679c SupportAutoload \u5c31\u4f1a\u8fd4\u56de true\uff0c\u8fd9\u6837\u4e0d\u7528\u989d\u5916\u58f0\u660e\u53d8\u91cf\u6216\u5b50\u7c7b\u91cd\u8f7d\u51fd\u6570\uff0c\u5c31\u53ef\u4ee5\u5b9e\u73b0\u5b8c\u7f8e\u7684\u5224\u5b9a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 Delphi \u4e2d\uff0c\u6240\u6709\u7eaf\u865a\u51fd\u6570\u7684\u4ee3\u7801 [&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":[257,846],"class_list":["post-6092","post","type-post","status-publish","format-standard","hentry","category-delphi","category-603","tag-257","tag-846"],"views":302,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/6092","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=6092"}],"version-history":[{"count":1,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/6092\/revisions"}],"predecessor-version":[{"id":6093,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/6092\/revisions\/6093"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6092"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6092"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6092"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}