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 7712443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:37:59+00:00 2026-06-01T01:37:59+00:00

Consider the follow code: TMyList = class(TList<IMyItem>, IMyList) Delphi shows me the error: [DCC

  • 0

Consider the follow code:

TMyList = class(TList<IMyItem>, IMyList)

Delphi shows me the error:

[DCC Error] test.pas(104): E2003 Undeclared identifier: 'QueryInterface'

Is there a generic list that implements IInterface?

  • 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-06-01T01:38:00+00:00Added an answer on June 1, 2026 at 1:38 am

    The classes in Generics.Collections do not implement IInterface. You will have to introduce it yourself in your derived classes and provide the standard implementations. Or find a different, third party, set of container classes to work with.

    For example:

    TInterfacedList<T> = class(TList<T>, IInterface)
    protected
      FRefCount: Integer;
      function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
      function _AddRef: Integer; stdcall;
      function _Release: Integer; stdcall;
    end;
    
    function TInterfacedList<T>.QueryInterface(const IID: TGUID; out Obj): HResult;
    begin
      if GetInterface(IID, Obj) then
        Result := 0
      else
        Result := E_NOINTERFACE;
    end;
    
    function TInterfacedList<T>._AddRef: Integer;
    begin
      Result := InterlockedIncrement(FRefCount);
    end;
    
    function TInterfacedList<T>._Release: Integer;
    begin
      Result := InterlockedDecrement(FRefCount);
      if Result = 0 then
        Destroy;
    end;
    

    You can then declare your specialised class:

    TMyList = class(TInterfacedList<IMyItem>, IMyList)
    

    Remember that you need to treat this class like any other that uses reference counted lifetime management. Only refer to it through interfaces.

    You’d really want to do some more work before TInterfacedList<T> was useful. You’d need to declare an IList<T> which would expose the list capabilities. It would be something like this:

    IList<T> = interface
      function Add(const Value: T): Integer;
      procedure Insert(Index: Integer; const Value: T);
      .... etc. etc.
    end;
    

    You can then simply add IList<T> to the list of interfaces supported by TInterfacedList<T> and the base class TList<T> would fulfil the interface contract.

    TInterfacedList<T> = class(TList<T>, IInterface, IList<T>)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following code (it's a little long, but hopefully you can follow): class
Consider the following code (for simplicity, I did not follow any C# coding rules).
This is a follow-up questions on a previous one . Consider this code, which
Yet another argument with a friend of mine. Consider this code: class User <
Please consider the following code: type TFoo1 = class public procedure DoSomething1; end; TFoo2
Follow up question from What is a "rooted reference"? consider this code, for a
This is a follow-up question to this one . Consider this example: #include <iostream>
Consider a model without an initialize method, defined as follows: class User < ActiveRecord::Base
Consider this code: new Ajax.Request('?service=example', { parameters : {tags : 'exceptions'}, onSuccess : this.dataReceived.bind(this)
Consider the below: public class DependencyA {} public class DependencyB {} public class DependencyC

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.