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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:05:08+00:00 2026-05-22T17:05:08+00:00

Say I have four classes A,B,C and D. D has property: Name(string) C has

  • 0

Say I have four classes A,B,C and D.

D has property: Name(string)

C has property: D1(type D)

B has property: C1(type C)

A has property B1(type B)

With A1 as instance of A, I can access: A1.B1.C1.D1.Name

Is there any performance issue with this?

How deep can a property residing won’t be any huge performance hit?

Or is there a limit to this hierarchy?

  • 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-22T17:05:08+00:00Added an answer on May 22, 2026 at 5:05 pm

    If all the properties in the chain are sealed (the default) and the getters are trivial, then the JITter will probably be able to inline the chain of calls. You will incur a sequence of pointer lookups, so this technically won’t be as fast as if A had a copy of Name, but the overhead is unlikely to be significant.

    If any of the properties in the chain are virtual, then I believe the JITter will not be able to inline the calls, and you will incur the overhead of one or more function calls (the property gets). That is still extremely small though (again, still assuming the getters are trivial).

    As always, the only way to be sure is to measure. And be conscious of what you are measuring: if the nested chain turns out to be, say, 50% slower than A having its own copy of Name, that doesn’t mean it’s a big deal, unless your program spends a large amount of its runtime on that Name get — highly unlikely! So do the right thing first — make the program readable and maintainable first — and if you measure and find it to be a bottleneck, then look at optimising it.

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

Sidebar

Related Questions

Say I have four sub-classes of 'Car'. One for each color. I want to
How can I change colors of elements using variables? Let's say we have four
Say i have Four tables 1) Studnets: Student_ID First Name Last Name 2) Contact
Let's say I have four projects: Project A (has a dependency on B and
Say I have four tables: ------------- features -------------- id: int name: varchar ------------------------------------- --------
We have situation where say we have four engineers that are working on software
Let's say we have four files: a.h, a.cpp, b1.h, and b2.h. And, we need
Let's say I have four tables: PAGE , USER , TAG , and PAGE-TAG
Scenario: Let's say I have four very similar applications (i.e. most of the functionality
Let's say I have the following xml: <one> <two> <three> <three> foo </three> <four

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.