Sometimes when I call a class’s .ToString() method, it returns the fully qualified name of the class. But for some class’s/struct’s (like Int32) it returns a string correspoding to the object (value of the integer). Does this mean the Int32 class overrides the ToString() method, and classes that return fully qualified names don’t override it, but instead just call base’s (Object‘s) ToString() method? Does the Object.ToString() implementation just return the class’s fully qualified name?
Sometimes when I call a class’s .ToString() method, it returns the fully qualified name
Share
Correct.
Correct.
Yes.
That is probably the case, yes. Of course, they could override the method and have the overriding method do exactly the same thing as the base class method, but that would be a bit pointless.
Correct.
You seem to have a solid grasp of how this works. My only correction would be to note that
System.Int32is a struct, not a class.