Type error switching from .m to .mm
I encountered this error:
cannot convert 'V_DTLPROMO_BTN_FN_T' to 'V_DTLPROD_BTN_FN_T' in argument passing
in code line:
[ m_vPromoDetails changeButton : V_DTLPROMO_BTN_2 btnFn : V_DTLPROMO_BTN_FN_ADD ];
Both arguments are of type V_DTLPROMO_BTN_T
& V_DTLPROMO_BTN_FN_T
which is are enum declared in the .h
file. Things were working fine until I changed the implementation file extension to .mm
from .m
to accommodate some C/C++ related code.
Prototype declaration
- ( void )changeButton : ( V_DTLPROMO_BTN_T )button
btnFn : ( V_DTLPROMO_BTN_FN_T )btnFn
Enum definitions
typedef enum
{
V_DTLPROMO_BTN_FN_NONE = 0, /**< None */
V_DTLPROMO_BTN_FN_RECOMMEND = 1, /**< Recommend */
V_DTLPROMO_BTN_FN_ADD = 2, /**< Add */
V_DTLPROMO_BTN_FN_DELETE = 3, /**< Delete */
V_DTLPROMO_BTN_FN_LOCATE = 4, /**< Locate */
V_DTLPROMO_BTN_FN_BUY_NOW = 5, /**< Buy Now */
V_DTLPROMO_BTN_FN_SHOPPED = 6, /**< Shopped */
V_DTLPROMO_BTN_FN_TWEET = 7, /**< Locate */
V_DTLPROMO_BTN_FN_NUM = 8 /**< Number of function choices */
} V_DTLPROMO_BTN_FN_T;
typedef enum
{
V_DTL开发者_如何学JAVAPROMO_BTN_1 = 0, /**< Button: 1 */
V_DTLPROMO_BTN_2 = 1, /**< Button: 2 */
V_DTLPROMO_BTN_3 = 2, /**< Button: 3 */
V_DTLPROMO_BTN_NUM = 3 /**< Number of buttons */
} V_DTLPROMO_BTN_T;
V_DTLPROD_BTN_FN_T
is an enum declared in another class.My detailpromo
class was somehow getting confused by that enum in detailprod
class.I noticed that the function names were same in both the classes ,so I tried to change the function name from changeButton
to changeButtonForPromo
.That did the trick and errors were removed.Still havent got the technical explanation for that.
精彩评论