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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:14:51+00:00 2026-05-10T21:14:51+00:00

For example: public class A : A.B { public class B { } }

  • 0

For example:

public class A : A.B {     public class B { } } 

Which generates this error from the compiler:

Circular base class dependency involving ‘A’ and ‘A.B’

I always figured a nested class behaved just like a regular class except with special rules concerning accessing the outer class’s private members, but I guess there’s some implicit inheritance occurring between the two classes?

  • 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. 2026-05-10T21:14:51+00:00Added an answer on May 10, 2026 at 9:14 pm

    There’s no implicit inheritance involved as far as I can tell. I would have expected this to be okay – although I can imagine weirdness if A and B were generic.

    It’s specified in section 10.1.4 of the spec:

    When a class B derives from a class A, it is a compile-time error for A to depend on B. A class directly depends on its direct base class (if any) and directly depends on the class within which it is immediately nested (if any). Given this definition, the complete set of classes upon which a class depends is the transitive closure of the directly depends on relationship.

    I’ve highlighted the relevant section.

    That explains why the compiler is rejecting it, but not why the language prohibits it. I wonder if there’s a CLI restriction…

    EDIT: Okay, I’ve had a response from Eric Lippert. Basically, it would be technically possible (there’s nothing in the CLI to prohibit it), but:

    • Allowing it would be difficult in the compiler, invalidating various current assumptions around ordering and cycles
    • It’s a pretty odd design decision which is easier to prohibit than to support

    It was also noted on the email thread that it would make this kind of thing valid:

    A.B x = new A.B.B.B.B.B.B.B.B.B.B.B.B(); 

    … but that would already (as noted by Tinister) be valid if B derived from A.

    Nesting + inheritance = oddness…

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

Sidebar

Ask A Question

Stats

  • Questions 118k
  • Answers 118k
  • 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 Database should always be designed and initially implemented in 3NF.… May 11, 2026 at 11:31 pm
  • Editorial Team
    Editorial Team added an answer This is a reference name, not a resolvable URI. It's… May 11, 2026 at 11:31 pm
  • Editorial Team
    Editorial Team added an answer The console class handles the thread synchronization for you. From… May 11, 2026 at 11:31 pm

Related Questions

How do I go about if I need to initialize an object's base with
Is there a way via System.Reflection, System.Diagnostics or other to get a reference to
An instance of class A instantiates a couple of other objects, say for example
I've been looking for a generic way to deal with bidirectional associations and a

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.