查看单个帖子
旧 2009-05-07, 05:30 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】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();
}
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)