BaseClass.h
class BaseClass
{
...
};
SubClass.h
#include "BaseClass.h"
class SubClass : public BaseClass
{
...
};
MyApp.h
class BaseClass;
class SubClass;
class MyApp
{
SubClass *pObject;
BaseClass *getObject()
{
return pObject;
}
};
I get a compiler error: error C2440: 'return' : cannot convert from 'SubClass *' to 'BaseClass *'
Why doesn't it work, surely you can automatically convert to a base-class without any casting?