philisophical question about object class (what was first: egg or fowl?)

  • Thread starter Thread starter mikie
  • Start date Start date
M

mikie

somebody asked me a question:
string is derived from object class, right? (i said yes)
so how it could be object class declares method returning string?

thanks for any explanation / link / whatever :)

mikie
 
string is derived from object class, right? (i said yes)

i say yes also
so how it could be object class declares method returning string?

I have a feeling you've accomplished this yourself without knowing it.
As long as your class A knows about class B (for example, by assembly
A referencing assembly B), there is no "which came first" about them.
The fact that string derives from object is completely irrelevant.
 
somebody asked me a question:
string is derived from object class, right? (i said yes)
so how it could be object class declares method returning string?

thanks for any explanation / link / whatever :)

Why couldn't it? There's nothing to stop this from other classes:

public class Base
{
public static Derived BuildDerived()
{
return new Derived();
}
}

public class Derived : Base
{
}

Jon
 
It's not just string. Nearly every primitive type in .NET includes a
member of its own type. It's a little weird to me too.
 
It's not just string. Nearly every primitive type in .NET includes a
member of its own type. It's a little weird to me too.

Actually, I think OP meant the fact that there is a String returning
method in the Object type.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top