I'm subclassing the MFC class CString (nothing wrong with the class, but trust me, I need to do this for specific implementation). I've succesfully customized some behaviors, but I noticed that I lost the implicit (LPCTSTR) operator that seems to occur when a CString is passed into a format string. This magic happens whether it's CString::Format or prinf/sprintf. For example:
CString Str = _T("Really cool string");
TCHAR szBuffer[32];
_stprintf(szBuffer, _T("Here it is: %s"), Str);
I haven't figured out how this magic works with a standard CString, since CString::FormatString just passes the variable argument list through to _vswprintf and _swprintf. But whatever it does is missing in my derived class.
The operator (LPCTSTR) is inherited as expected, and works when explicitly called.
Any ideas?