c pound

I reject your reality and substitute my own!
posts - 46, comments - 37, trackbacks - 40

My Links

News

Archives

Image Galleries

Blog Communities

Blog is a stupid word

Lunch Hour

Resources

Well, actually...

It was pointed out to me last night that an integer is, in fact, a value type and not an object. Well, yes and no. In C#, an int is an integral type that gets you a System.Int32 structure, as you can see [here]. Further, a System.Int32 structure derives from System.ValueType which, in turn derives from System.Object. As they say, “This is the ultimate base class of all classes in the .NET Framework; it is the root of the type hierarchy.” Everything is an object. Ha! Additionally, any value type can be implicitly converted to an object any time you like.

Print | posted on Thursday, October 06, 2005 4:54 AM |

Feedback

Gravatar

# re: Well, actually...

Yep, that is completely correct. In fact in one book that I use in my classes I teach, it actually even goes as far as to say that .NET is more OO than Java since EVERYTHING is derived from Object. I have a hard time believeing that, but never the less Just wanted to validate what you are saying.

Good post.
10/6/2005 5:42 AM | Michael Van Cleave
Gravatar

# re: Well, actually...

Ever thought of this...

System.ValueType is a class but no other class can inherit this. Its only interfaces which can derive this.

So what happened to the theory of
class deriving from any non-sealed classes.

Moreover... as per theory struct can derive only structs/interfaces.. then how come any struct is bydefault derived System.ValueType which is a class.

Brainteaser??????
10/6/2005 4:13 PM | IamJunk
Gravatar

# re: Well, actually...

In my previous post... I wrote.. "Its only interfaces which can derive this", what I actually intended to write was "Its only Structures which can derive this (ofcourse, implicitly)
10/6/2005 4:17 PM | IamJunk
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 

Powered by: