Overriding Object::ToString()

  • Thread starter Thread starter etam
  • Start date Start date
I wouldn't have thought so. Which version of VS are you using?
2005...

Your code in that picture isn't precisely what's shown at that
previous link, so what else is different?

It is the same... I've copied and pasted it.
Do you have a small self contained example that reproduces this?

I don't really understand what do You mean ;).

Thanks,
Etam.
 
Your code in that picture isn't precisely what's shown at that
It is the same... I've copied and pasted it.

It's not, the name has changed at the very least.
I don't really understand what do You mean ;).

An entire single file that compiles - just stick everything in the
main source file of a console project that reproduces the issue for
you (since what you showed is fine for me).

Dave
 
Why does String::ToString even exist? Why is there a method that converts a
String to a String? Isn't that a no-op? ;) I can see why you'd want to
override it, it should do nothing as it is...

And how does one find out what built-in methods are virtual/overridable? I
had no idea I could redefine ToString( ) for example. By experimentation
only, or is there a reference for this? MSDN2 isn't much help, you have to
know the answer before you can look up the question!!! lol
 
Peter Anthony said:
Why does String::ToString even exist? Why is there a method that converts
a

So that you can call ToString on *any* object.

String to a String? Isn't that a no-op? ;) I can see why you'd want to

Yes, it is a no-op.
override it, it should do nothing as it is...

And how does one find out what built-in methods are virtual/overridable? I
had no idea I could redefine ToString( ) for example. By experimentation
only, or is there a reference for this? MSDN2 isn't much help, you have to
know the answer before you can look up the question!!! lol

You're right about that, even the class member list on msdn doesn't indicate
virtual-ness.

I think Reflector indicates virtual members with a different icon though
(there seems to be a correlation between the double pink box and
virtual/override functions).
 
Back
Top