Is there such a thing as a C# style extension method in C++ ?
- by Gary Willoughby
I'm currently learning C++ and i run into the simple problem of converting an int to a string. I've worked around it using:
string IntToString(int Number)
{
stringstream Stream;
Stream << Number;
return Stream.str();
}
but though it would be more elegant to use something like:
int x = 5;
string y = x.toString();
but how do i add the toString() method to a built in type?
or am i missing something totally fundamental?