Storing a buffer for every vector instance will escalate very very fast. I'd suggest using a private static buffer for the class. (or even better std::string! but I provide a char-array example to go with your first attempts)
class V2D{public: ...private: ... static char m_string[50]; // since 50 was the number you're using in your example, see note below};const char *V2D::toString(){ sprintf(m_string,"(%f, %f)",x,y); return &m_string;}
Or something similar, haven't got the time to read it through for errors atm :) Why 50 size of the buffer though?
With regular floats you have 23 bits of mantissa, which equals a maximum of 7 significant digits. Add 2 for the "0." and you have 9 characters for each float.
Surely the buffer doesn't have to be larger than 23 characters? ( 9 per float + 5 for "(, )" + terminating null character? Or have I missed something? (probably have, am quite tired atm:)
Then again, it's better to have a slightly oversized buffer than a too small one :) (and it's only 27 bytes difference since you'll be storing it statically)
Do consider using std::string though, and you won't have to worry about the buffer size :)
Enough ranting from me :)