Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6808677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:59:09+00:00 2026-05-26T19:59:09+00:00

Despite years of Delphi programming I just ran into a class declaration style I

  • 0

Despite years of Delphi programming I just ran into a class declaration style I had never seen for a class that supports IUnknown:

TBCUnknown = class(TBCBaseObject, IUnKnown)
private
  FRefCount: integer;
  FOwner   : Pointer;
protected
  function IUnknown.QueryInterface = NonDelegatingQueryInterface;
  function IUnknown._AddRef = NonDelegatingAddRef;
  function IUnknown._Release = NonDelegatingRelease;
  function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
...

As you can see, assignments of class methods to IUnknown interface methods are being done right in the class declaration. This looks really strange to me especially since I don’t see how the IUnknown methods could be assigned to, before the constructor is called. Is this some kind of compile-time shortcut for making assignments between a class’s methods and the interface pointers for an interface the class accepts, that are later resolved at run-time? If someone could provide a little information on how this works and what Delphi idiom supports this kind of construct I’d like to know.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T19:59:09+00:00Added an answer on May 26, 2026 at 7:59 pm

    It’s called Method Resolution Clause and it allows you to specify which method actually implements the specified interface method. This means that the implementing method can have a different name than the method declared in the interface (but the method signature still has to match). Without the clause, Delphi automatically resolves the implementation methods based on their names.

    In your example, the declaration means that IUnknown._AddRef is implemented by TBCUnknown.NonDelegatingAddRef and IUnknown._Release by TBCUnknown.NonDelegatingRelease.

    As far as I know, this has been supported from the beginning when interface support was added to the language. You probably haven’t noticed it because it’s not used or needed so often.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Despite using PHP for years, I've never really learnt how to use expressions to
I've been programming for over 20 years, but have recently turned to JavaScript. Despite
Despite me working with C# ( Windows Forms ) for years, I'm having a
Despite this being one of the best error messages I've ever seen (second only
I've been programming for a few years but I'm new to JavaScript. I'm trying
despite many tries I can't get the result that I would like to see
Despite all the advances in 3D graphic engines, it strikes me as odd that
Despite having read Programming in Scala several times, I still often finds important Scala
Unfortunately, despite having tried to learn regex at least one time a year for
Despite primarily being a windows user, I am a huge fan of rsync. Now,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.