I have an MFC C++ program that contains two classes, as follows;
struct MyStruct
{
'
'
};
class Class1
{
public:
virtual MyStruct *MyFunc(LPCTSTR x);
virtual void MyFunc(MyStruct *x);
'
'
};
class Class2 : public Class1
{
public:
virtual void MyFunc(MyStruct *x);
'
'
};
main()
{
'
'
CString Str = _T("WTF");
Class2 a;
a.MyFunc(Str);
'
'
}
When I compile this under VS2003 code I get error C2664: 'MyFunc' : cannot convert parameter 1 from 'class CString' to 'struct MyStruct *' whereas I would have expected the compiler to pick up the globally defined conversion from CString to LPCTSTR and call the base member MyStruct *MyFunc(LPCTSTR x); Note that if I remove virtual void MyFunc(MyStruct *x); from the definition of Class2 it compiles just fine.
I'm probably missing something pretty simple here, but I can't figure out why this doesn't work. Any ideas greatly appreciated.