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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:40:23+00:00 2026-05-18T19:40:23+00:00

I wrote a simple library in which the user extends one of my abstract

  • 0

I wrote a simple library in which the user extends one of my abstract classes and then passes that class to one of my functions.

//user class
class My_robot extends Robot{
}

//My library function
function Robot_maker("path.to.My_robot")

The robot maker function then creates an array of the type Robot[]. The user then can have the array returned to them by calling another one of my functions Robot[] get_robot_army()

I know that I can cast the Robot[] array element by element but is there a way to cast the entire array at once? (I want to abstract this away from the end user)

Is there a way to use Reflection to change the return type of a function?

///////////////////////////// There is some need for clarity ///////////////////////////


The code in question is the function batch_result() on line 124

I want to be able to return the class that the user supplied using the function batch_set_relationship() on line 139


As an example if some one ran here on line 88 how can I pass the user an array of the supplied custom supplied class.

Also can some one clarify why the cast to an array of a different type fails.

  • 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-18T19:40:24+00:00Added an answer on May 18, 2026 at 7:40 pm

    One way you can think, add the complete array into an list or any collection and send that as a return type

    In that way you can achieve the casting of return type.

    With the reflection class you cant change the class type but you can defnitely get the class type dynamically, then later you need to modofy the class type to meet your requirements

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

Sidebar

Related Questions

I wrote simple class that on the start it just increase the value of
I wrote a simple webform that will take the user's information (via POST) and
i wrote simple 3 functions to scrape titles , description and keywords of simple
I wrote simple load testing tool for testing performance of Java modules. One problem
I wrote a simple function, that makes emacs add matching quotes (so when I
I wrote a simple plugin which sets some css code using wp_options. It all
I want to develop a simple windows manager, but do not know which library
I started a little experiment today: I wrote a C++ class which depends on
While writing a simple library to parse a game's data files, I noticed that
I've been given this simple VB application and library which I'm told can open

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.