By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,586 Members | 623 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,586 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

Aug 22 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a

On Aug 22, 4:04 pm, mikie <m...@exoergee.plwrote:
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.

Aug 22 '07 #2

P: n/a
On Aug 22, 3:04 pm, mikie <m...@exoergee.plwrote:
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

Aug 22 '07 #3

P: n/a
On 2007-08-22 16:30:01 +0200, "Jon Skeet [C# MVP]" <sk***@pobox.comsaid:
On Aug 22, 3:04 pm, mikie <m...@exoergee.plwrote:
>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:
:-D
stupid me... or may be just strong power of suggestion... ;)

thx!

Aug 22 '07 #4

P: n/a
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.

Aug 22 '07 #5

P: n/a

On Aug 22, 5:06 pm, not_a_commie <notacom...@gmail.comwrote:
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.

Aug 22 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.