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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:11:46+00:00 2026-05-12T11:11:46+00:00

Suppose i have the code snippet as follows : ( clarification purpose/not well formed

  • 0

Suppose i have the code snippet as follows : ( clarification purpose/not well formed)

class Employee
{
    #region fields

    protected string _empID;

    protected string _empName;

    protected readonly string _ssn;

    #endregion

    public Employee(){}   

    public Employee(string _empID,string _empName,string _ssn)
    {
        this._empID =_empID;
        this._empName=_empName;
        this._ssn = _ssn;
    }
}


class Manager : Employee
{
    private string _branchID;

    public Manager(int  _branchID):base(string _empID,string _empName,string _ssn)
    {
        this._branchID=_branchID;
    }
}

static void Main()
{
   Manager mgr = new Manager("1","sam","xxx","Branch1");
}

Using base keyword I am invoking parent class constructor .

In this case how the inheritance is organized? I have some bad assumptions as follow:

As Manager is derived from Employee, Manager class is filled with (empID,empName,ssn)

-----------------
 Manager
-----------------
empID
empName
ssn
branchID

step 1 : constructor invoking :base( “1”,”sam”,”xxx”)

step 2 : base class(Employee) constructor fills the derived class filed (empID,empName,ssn)

step 3 : branchID is assigned by derived class constructor

…….

My question is

  • If a class is derived from base class, the derived class also has the base class’ hidden fields?
  • Derived class shares Base class fields? I mean separate memory block is allocated for Base class and derived class?
    • 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-12T11:11:46+00:00Added an answer on May 12, 2026 at 11:11 am


      (source: rvenables.com)

      Yes, the derived class will also contain the base class fields in memory. On page 112 of CLR via C#, Jeffrey Richter says:

      “Then, M3 executes its code to construct a Manager object. This causes an instance of the Manager type, a Manager object, to be created in the managed heap, as shown in Figure 4-9. As you can see, the Manager object-as do all objects-has a type object pointer and sync block index. This object also contains the bytes necessary to hold all of the instance data fields defined by the Manager type as any instance fields defined by any base classes of the Manager type (in this case, Employee and Object).” (Emphasis Added)

      It’s also worth noting that a separate block of memory is created for any base types. But ONLY for the type data (so only once, at most). When you create a Manager object (which derives from Employee), the CLR will ensure that there is a Manager Type Object, and an Employee Type Object on the heap.

      1) Richter, Jeffrey. CLR via C#. Redmond: Microsoft Press, 2006.
      (Amazon Link)

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

    Sidebar

    Ask A Question

    Stats

    • Questions 262k
    • Answers 262k
    • Best Answers 0
    • User 1
    • Popular
    • Answers
    • Editorial Team

      How to approach applying for a job at a company ...

      • 7 Answers
    • Editorial Team

      How to handle personal stress caused by utterly incompetent and ...

      • 5 Answers
    • Editorial Team

      What is a programmer’s life like?

      • 5 Answers
    • Editorial Team
      Editorial Team added an answer Try appending this: &chxt=x,y,r&chxl=2:|Mean|Median| It might not be exactly what… May 13, 2026 at 11:51 am
    • Editorial Team
      Editorial Team added an answer As Alex says, you'll just recreate the anonymous type. To… May 13, 2026 at 11:51 am
    • Editorial Team
      Editorial Team added an answer Maybe use a QTextEdit, and limit it to one line. May 13, 2026 at 11:51 am

    Related Questions

    I'm supposed to do a presentation for my co-workers on a web framework I
    Rational I would like to have more detailed logging debugging/logging output on a few
    I found similar questions asked here but there weren't answers to my satisfaction. So
    Suppose you have two models, User and City, joined by a third model CityPermission:

    Trending Tags

    analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

    Top Members

    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.