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

  • Home
  • SEARCH
  • 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 4572096
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:35:52+00:00 2026-05-21T19:35:52+00:00

in my application I have a tree-like data structure. The nodes are of class

  • 0

in my application I have a tree-like data structure. The nodes are of class X. I have another class Y which is derived from X. Eventually, I need to “transform/change” the nodes from type X to type Y – in the whole tree structure.

Is there an easy way to do this or do I have to parse the whole tree, recreating it by instantiate each node with type Y?

Thanks in advance,
Frank

Edith says: Thanks for all your answers! I try to explain, why I need this behavior:
Let’s imagine, we are a caterer. We want to model our portfolio in a tree. One node could be “soups” and we offer potato soups, tomato soups and noodle soups – each one is a child node of the “soups” node. After finishing the modeling, we present the tree to a customer who choses the “basic catering service”. That means that she can chose one of the soups for her dinner.
For my underlying model, that means I need an additional field “IsSelected”, which I do not need, when the caterer creates the portfolio. So I want to derive class Y from class X with the additional field.

  • 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-21T19:35:53+00:00Added an answer on May 21, 2026 at 7:35 pm

    Yes, you will have to traverse the whole tree and re-create all the nodes.

    Which makes it a good idea to reconsider the design that led to this situation.

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

Sidebar

Related Questions

I have an application which utilizes graph (tree-like) custom structures. The structures are not
I'm using Core Data and I have a file-folder tree-like structure. So I've created
In my console application have an abstract Factory class Listener which contains code for
I have an application storing a tree structure and is able to generate the
One of my entity managed objects need to setup a runtime-only tree-like structure where
I've implemented a specialised tree data structure for a ray tracing application. I'm using
I have a large number objects which are tree like structures. I have a
I have a tree representation of pages in a CMS application. I understand how
I have an application where a Hilbert R-Tree (wikipedia) (citeseer) would seem to be
I have a large tree of Java Objects in my Desktop Application and am

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.