![]() |
【转帖】ype Cast Error Using Odrx-declare-members
type cast error using odrx_declare_members
type cast error using odrx_declare_members i recently switched to version 1.1.0 from 1.09. i was hoping someone could tell me if i am correctly using the ocrx_declare_members macro for the following case. class cicodrenderview : public odrxobjectimpl<odgsbaseview> { odrx_declare_members(cicodrenderview); public: cicodrenderview(); ...... } with the above, i get: error c2594: 'type cast' : ambiguous conversions from 'class odrxobject *' to 'class cicodrenderview * by expanding the macro, i find that the problem occurs in this line: return odsmartptr<cicodrenderview>(((cicodrenderview*)pob j->queryx(cicodrenderview::desc())), kodrxobjattach); thanks. hi, no, odrx_declare_members macro can't be used in this case. odgsbaseview is derived from multiple rxobject-based classes. you should make additional branch to use rx rtti with cicodrenderview object, however odsmartptr<cicodrenderview> can't be ever created. code: class cicodrenderview_rtti : public odrxobject { cicodrenderview_rtti() {} public: odrx_declare_members(cicodrenderview_rtti); cicodrenderview* getcicodrenderviewinterface() { return static_cast<cicodrenderview*>(this); } }; class cicodrenderview : public odgsbaseview, public cicodrenderview_rtti { friend class cicodrenderview_rtti; protected: cicodrenderview(); public: ...... } class cicodrenderviewimpl : public odrxobjectimpl<cicodrenderview> { public: cicodrenderviewimpl(); } |
| 所有的时间均为北京时间。 现在的时间是 04:39 PM. |