Tostring()
Tostring() method is deive from which class?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sam HobbsPosted Aug 1, 2010, 6:38 PM
People that voluntarily attempt to help others see many vague questions and questions written carelessly. I often spend more time asking for clarification than the person spent asking the question. Use of the correct terminology can be critical. It is okay to guess what the person means except if you guess wrong it might be better to not answer. I think it is important to always make it clear that you are guessing when you guess; I do. So note that I expected the person asking the question to clarify the question or something such as that. Instead I spend a lot of time clarifying what you said because you tried to guess what the person meant. I would have preferred that the person asking the question ask for clarification.
Note that your original answer could cause a beginner to be very confused. As I said, the term derived has a very specific meaning in this context.
Roy SPosted Aug 1, 2010, 5:42 PM
I didn't stood still thinking about that 'mistake' and answered the question he probably meant to ask and not what literally was said in the post. I don't want to be rude or anything but you kinda sound like a computer, shouting 'syntax error'. Maybe next time you could add a little extra to your post like:
[what's wrong with question]
[what he probably meant] + [answer to that]
Sam HobbsPosted Aug 1, 2010, 5:12 PM
2) Yes, all .Net classes are derived from System.Object, either directly or indirectly. Value types (structures) are derived from the ValueType Class which is derived from the Object class.
3) No. The question is not "'from which class comes the ToString() method". Please read the question again. The word "comes" is vague and has no specific meaning in this context but the term "derives" is very specific in this context.
Roy SPosted Aug 1, 2010, 4:32 PM
1) If a class is derived from another, then the child class has all the members that the parent class has (and its own).
2) All classes (and other things maybe?) are derived from the object class (which has that ToString() method).
3) I thought that his question was 'from which class comes the ToString() method?' so knowing all of that I think the answer is from the object class.
If something is wrong then tell me. Maybe I got the wrong idea of what 'to derive' is?
Sam HobbsPosted Aug 1, 2010, 4:19 PM
Please understand that ToString is derived from nothing; it is a method, and methods are not derived; not ever. Saying that ToString is derived from System.Object can make a beginner very confused. ToString is a member of System.Object.
Roy SPosted Aug 1, 2010, 3:21 PM
http://msdn.microsoft.com/en-us/library/system.object.tostring%28VS.80%29.aspx
Sam HobbsPosted Aug 1, 2010, 1:48 PM