如何从2个WTL类中派生一个类 [英] how to derive a class from 2 WTL classes

查看:100
本文介绍了如何从2个WTL类中派生一个类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我有一个按钮类:


Hi all

I have a button class :


class CTransparentBtn : virtual public CWindowImpl<ctransparentbtn, WTL::CButton, CControlWinTraits>
{
// ...
};


并且我从codeproject.com找到了用于菜单按钮的此类



and I''ve found this class for menu button from codeproject.com


namespace WTLEX
{

template <bool class="" tbase="WTL::CButton," twintraits="CControlWinTraits">
class ATL_NO_VTABLE CMenuButtonImpl : public CWindowImpl< T, TBase, TWinTraits>
{
// ...
};

class CMenuButton : public CMenuButtonImpl<false, CMenuButton>
{
// ...
};

} //namespace WTLEX</bool>


那么如何从"CTransparentBtn"派生"CMenuButton"以使用CTransparentBtn的函数呢?

预先感谢您


so How can I derive "CMenuButton" from "CTransparentBtn" to use CTransparentBtn''s functions??

thank u in advance

推荐答案

如果您采用其他方法,您仍然必须对CTransparentBtn进行模板化

you''re still going to have to template your CTransparentBtn if you go the other way

template <class theClass, class theBase>
class CTransparentBtn : public CWindowImpl<theClass, theBase, CControlWinTraits>




然后




then

template <class theClass,class theBase>
class ATL_NO_VTABLE CMenuButtonImpl : public CTransparentBtn <theClass, theBase>


您会走另一条路吗?

wouldn''t you go the other way?

class CTransparentBtn : public CMenuButtonImpl<ctransparentbtn,wtl::cbutton,ccontrolwintraits>
{
// ...
};


这篇关于如何从2个WTL类中派生一个类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆