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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:45:19+00:00 2026-06-11T13:45:19+00:00

I have a group of functions that use Sub-Range types for their input parameter.

  • 0

I have a group of functions that use Sub-Range types for their input parameter.

const
  ImprovementNodeCount = 20;
  SaleAllocationNodeCount = 10;

type   
  TImprovementNodePrintOrders = 0..ImprovementNodeCount;
  TSaleAllocationNodePrintOrders = 0..SaleAllocationNodeCount;


  function SaleImprovementType(PrintOrder: TImprovementNodePrintOrders): TSaleReferenceRecord;

  function SaleAllocationType(PrintOrder: TSaleAllocationNodePrintOrders): TSaleReferenceRecord;
  function SaleAllocationAcres(PrintOrder: TSaleAllocationNodePrintOrders): TSaleReferenceRecord;
  // many more functions with different SubTypes

This has been working very well for me. I have a new situation where it would be convenient to pass one of these functions as a parameter. My sub-ranges are now causing problems because they are different types.

All of the functions look the same except for the sub-type. I tried to add a new function type like this

  TGetReferenceFunction = function (Index: cardinal): TSaleReferenceRecord;

Right now the compiler complains that the types are different when I try to pass the function parameter as a TGetReferenceFunction. Is there any way to create a function type that will include all of these functions that have different sub-type parameters?

[DCC Error] SaleNameMap.pas(295): E2010 Incompatible types: 'Cardinal' and 'TImprovementNodePrintOrders'

What I really need is a type that is all numeric sub-types. I know I can create a different function type for each sub-type I have, but that still will not let me pass these functions as parameters into one common function.

I’m guessing this is not possible. If so I have some other options, but in case there is something I am missing I thought I would try here first.

  • 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-11T13:45:20+00:00Added an answer on June 11, 2026 at 1:45 pm

    If you really want one function to accept all those distinct function types, then you’ll have to sacrifice type safety. You can do this with a cast:

    TGetReferenceFunction(@SaleAllocationAcres)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a group of radio with an onchange handler: <input type=radio name=Q12 value=radio
I have several query results that use one or more aggregate functions and a
I have a group of numeric functions in Clojure that I want to validate
I have a group of links that I call fancybox on with the arrows
I have a group of buttons that should act like toggle buttons, but also
I have a group of 4 divs and I'm looking to use jQuery to
I'm building an application that needs to use the Linux group keyring to share
So, I have a group of ASINetworkQueues that currently run together resulting in a
Using Doxygen 1.7.4 Sometimes I'll have a block of public member functions that belong
I have a group of model peer classes that should all have the same

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.