给出简单例子,体现一下设计思路
接口:
IPlatform: IUnknown
IView: IPlatform
IPicView: IView
---------------------------------
IContorl: IPlatform
IToolbarCtl: IContorl
=======================================
实现:
/
// IPlatformImpl
template <class T>
class ATL_NO_VTABLE IPlatformImpl :
public T
{
public:
xxxx // IPlatform 的方法
}
/
// IViewImpl
template <class T, class I>
class ATL_NO_VTABLE IViewImpl :
public T,
public I
{
BEGIN_MSG_MAP(IViewImpl)
MESSAGE_HANDLER(WM_ERASEBKGND , OnEraseBkGnd)
END_MSG_MAP()
public:
DECLARE_WND_CLASS("PLATFORM_VIEW")
yyyy // IView的方法
}
//
class CPicView :
public IViewImpl< CWindowImpl<CPicView>, IPlatformImpl<IPicView> >,
public CComObjectRoot,
public CComCoClass<CPicView>,