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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:10:33+00:00 2026-06-18T01:10:33+00:00

The C# spec states: The declared accessibility of a base class member does not

  • 0

The C# spec states:

The declared accessibility of a base class member does not control
whether the member is inherited–inheritance extends to any member
that isn’t an instance constructor,static constructor,or destructor.
However, an inherited member may not be accessible in a derived type,
either because of its declared accessibility or because it is hidden
by a declaration in the type itself.

Why is an inaccessible member considered inherited? Why is such a distinction made/practical?

As a concrete example

class A
{
    const string foo = "c";

    internal void DoWork() { }
}

class B: A
{
    const string bar = "d";//renamed to foo does not appear to have a noticeable impact
    B() { bar = foo; }//inaccessible due to protection level

    internal new void DoWork() { }//hide inherited member
}

In my mind, at runtime inheritance means sharing state and/or behavior. In the case of foo such a thing does not occur.

It is up to B as to whether or not to inherit the behavior of DoWork(). Therefore, DoWork() being a member of B is intuitive and relevant. On the other hand, why is foo treated as a Member of B? B cannot read from or write to foo.

  • 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-18T01:10:34+00:00Added an answer on June 18, 2026 at 1:10 am

    In your case, you’re talking about const, which is implicitly static. Static members effectively aren’t inherited anyway. Having just checked the spec, that implies that static members are inherited – but as they don’t represent state and can’t be part of polymorphism, it’s at least a “different” kind of inheritance. I think of static members as merely being “available via simple name” to derived classes, assuming they’re accessible at all – in other words, it’s to do with name resolution more than real inheritance.

    If this were a private instance variable, then it would be part of the state of any instance of an instance of any type derived from A, so it would be inherited state. If you think about an object’s state and behaviour being inherited, it makes sense in my view.

    (It’s probably worth being clear about whether you’re interested in the static part or the private part; they’re somewhat orthogonal.)

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

Sidebar

Related Questions

The C# spec, section 10.1.1.1 , states: An abstract class is permitted (but not
I have problem in using ExceptionMatcher...My example spec: class DescribeBall extends \PHPSpec\Context { private
I am accustomed to C# not performing overflow checks, as the language spec states
The EJB 3.1 Spec. states: The enterprise bean must not attempt to manage threads.
Here's my current class definition and spec: class Event < ActiveRecord::Base # ... state_machine
I have the following spec: it saves a default 'active' status if not specified
What Servlet Spec and JSP version does Jboss 4.2.3 support?
Possible Duplicate: iPhone 5 CSS media query The iPhone 5 tech spec states screen
I want to return whether or not we offer service in a particular location.
The ECMAScript 5 spec states the following: Usually a Lexical Environment is associated with

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.