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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:33:35+00:00 2026-05-12T09:33:35+00:00

It is true in .NET that all types inherit from System.Object. What I find

  • 0

It is true in .NET that all types inherit from System.Object.

What I find paradoxical, is a few methods on System.Object – namely

  • public virtual string ToString();
  • public virtual bool Equals(object objA, object objB);

System.String is inherited from System.Object:

[Serializable]
public class String : Object { /*...*/ }

System.Boolean is inherited from System.Object:

[Serializable]
public struct Boolean : Object { /*....*/ }

What is the going on under the covers that allowed the System.Object class to allow sub-classes to be used as return types on its methods? How did this code ever compiled, as there seems to be a circular references. String <-> Object <-> Boolean.

I’m sure I will see statements, on “thats how it is implemented”, but I can understand if these return types were “System.Object”‘s themselves, and then a sub-class used the implemenations of string, bool and other System.ValueTypes to declare a new base class.

I hope that makes sense.

Thanks in advance,

Dominic

  • 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-12T09:33:35+00:00Added an answer on May 12, 2026 at 9:33 am

    It’s no big deal, a base class can always reference subclasses. For instance, this code is perfectly legal :

    class A
    {
        public B CreateB();
        {
            return new B();
        }
    }
    
    class B : A
    {
    }
    

    Note that it would be an issue if A and B were defined in separate assemblies, because that would require a circular assembly reference, which is not allowed

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

Sidebar

Related Questions

Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
Could someone explain why this works in C#.NET 2.0: Nullable<DateTime> foo; if (true) foo
Is it true that the only way to handle default function arguments is through
Is it true that the smallest amount of memory that I can allocate in
We would like to enumerate all strings in a resource file in .NET (resx
Here's my setup. I'm using .NET: I have a Main.aspx lets call it. That
I have an InteropUserControl in a .NET assembly that works fine in other operating
I have always marked my .NET assemblies as visible to COM with [assembly: ComVisible(true)]
The ASP.NET web application I am developing needs to support two different types of
I am trying to replace the JavaScript onclick event handler in ASP.NET that is

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.