casting
-
I have a constructor defined as shown: CFirstClass:: CFirstClass(const CFirstClass &myClass) { // some code CFirstClass* pAnotherFirstClass; pAnotherFirstClass= &myClass; // error on this line // code } The error states: error C2440: '=' : cannot convert from 'const class CRegisterItem *' to 'const int' This conversion requires a reinterpret_cast, a C-style cast or function-style cast pls help. :rolleyes:
-
I have a constructor defined as shown: CFirstClass:: CFirstClass(const CFirstClass &myClass) { // some code CFirstClass* pAnotherFirstClass; pAnotherFirstClass= &myClass; // error on this line // code } The error states: error C2440: '=' : cannot convert from 'const class CRegisterItem *' to 'const int' This conversion requires a reinterpret_cast, a C-style cast or function-style cast pls help. :rolleyes:
This sort of error often means a missing #include file, in this case the one for CRegisterItem. It's hard to figure out, because from your code I have no idea what a CRegisterItem *is* ( I don't believe it's MFC, although I've been wrong before ). Christian #include
-
I have a constructor defined as shown: CFirstClass:: CFirstClass(const CFirstClass &myClass) { // some code CFirstClass* pAnotherFirstClass; pAnotherFirstClass= &myClass; // error on this line // code } The error states: error C2440: '=' : cannot convert from 'const class CRegisterItem *' to 'const int' This conversion requires a reinterpret_cast, a C-style cast or function-style cast pls help. :rolleyes:
Change
CFirstClass* pAnotherFirstClass
to
const CFirstClass* pAnotherFirstClass
Tomasz Sowinski -- http://www.shooltz.com.pl