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

Symptom: No serializer defined for type: System.Array Since all C# arrays inherit from the
In ASP.net MVC 2, I can use routes.RouteExistingFiles = true; to send all requests
I have this function of mine which selects all room types from the database,
I have an ADO.NET Data service that I run through WCF: public class AdminService
In this fiddle I'm just trying to return true : http://jsfiddle.net/WCFtp/ for jQuery key
When AllowSorting is true on an asp.net GridView, it just makes the headers with
Question about GridView sorting in VB.NET: I have a GridView with AutoGenerateColumns = True
I have a server-sent events handler in ASP.NET Response.ContentType = text/event-stream; while (true) {
select 'true' from dual where 1 not in (null,1); when we execute this which
I have been working on a system which I'm using protobuf-net (version 2.0.0.480) for

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.