Operater overloading - (const char + CString)
I'm creating a String class without any class libraries included.
To overload operator methods like CString + CString, CString + const char and CString + const char * aren't a problem at all.
But when I'm supposed to switch the factors I'm about to deal with my dearest problem. Suppose I'm going to add const char to CString.
If I'm about to create the method heading like the others it would look something like this:
const char operator+(CString &bla);
And of course, that won't work.
I've searched the entire Internet, I believe, and cannot find huge amount of examples of my problem. So I get kind of nervous about this.
I found a way though, it's possible to write:
CString& operator+(const char &c, CString &s);
When I compile, I get one error:
error C2804: binary 'operator +' has too many parameters
So, any suggestions how to get the syntax right?