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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:31:34+00:00 2026-06-14T00:31:34+00:00

I have an array of Tiles[w,h] and by mistake I could (without any obvious

  • 0

I have an array of Tiles[w,h] and by mistake I could (without any obvious errors, so I guess this is okay to do) assign a child object LibraryTile to one of its cells. It shows up as LibraryTile in intellisense hover popup.

I’m not sure if it will not bring any undesired effects, like increased memory consumption (it’s a memberwise copy, not a reference), so I don’t know if I should change my methods or if it is fine to leave them as is.

  • 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-14T00:31:35+00:00Added an answer on June 14, 2026 at 12:31 am

    I assume LibraryTile is a subclass of Tile? Which is why you tagged it as parent-child?

    What you’re seeing is just polymorphism. It will “act” like a Tile, just the same. Whether or not it consumes more memory depends on what LibraryTile adds to its base class. You can test at runtime if Tile is an actual LibraryTile and, if so, cast to a LIbraryTile to do “special stuff” so to say. But without more context, I can’t advise you on techniques to take advantage of polymorphism (e.g. virtual methods, interfaces, etc).

    If you don’t want to allow inheritance for whatever reason, you can seal your parent class.

    http://msdn.microsoft.com/en-us/library/88c54tsw%28v=vs.71%29.aspx

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

Sidebar

Related Questions

I have array result like this: Array ( [0] => stdClass Object ( [id_global_info]
Let's say I have this image: and I have this 2D array tiles[] ..
I have an array of different times that looks like this: 20120628061533.0, 20120628064851.0, 20120628064853.0,
I have array like this: $path = array ( [0] => site\projects\terrace_and_balcony\mexico.jpg [1] =>
Let's say I have this 2D Array map { 0,0,0,0,7,1,1,1,1,1,1,1,1 }, { 0,7,7,7,7,1,1,1,24,1,1,1,1 },
Hopefully this will be clear enough. I have a 2d map made of tiles,
I have a row-based multidimensional array: /** [row][column]. */ public int[][] tiles; I would
I have an array of tiles that are of the type Texture2D and want
I have a medium sized array of tiles represented as numbers that pygame blits
As seen in the image above, I have a 2D array of tiles, each

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.