Click here to Skip to main content
12,632,090 members (26,327 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C++ WTL
Hi all

I have a button class :


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

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>

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

thank u in advance
Posted 21-May-11 0:16am
Updated 21-May-11 2:16am
v3
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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>
  Permalink  
Comments
bartello 22-May-11 15:42pm
   
Ok!! thanks a lot!! :)
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

wouldn't you go the other way?

class CTransparentBtn : public CMenuButtonImpl<ctransparentbtn,wtl::cbutton,ccontrolwintraits>
{
// ...
};
  Permalink  
Comments
bartello 21-May-11 7:20am
   
thanks! but it's harder than u think. In this case I had to add some template arguments to class CTransparentBtn. I'd like to know the answer to MY question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.161208.2 | Last Updated 21 May 2011
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100