So I have a simple class that I want to take a functor:
Now, since this is a derived class that merely overrides a virtual function, it must be in my header:Code:template<typename T> class CMyMFCEditBrowseCtrl: public CMFCEditBrowseCtrl { public: CMyMFCEditBrowseCtrl(T OnAfterUpdateFunc): m_OnAfterUpdateFunc(OnAfterUpdateFunc) {} virtual void OnAfterUpdate() { m_OnAfterUpdateFunc(); } protected: T m_OnAfterUpdateFunc; };
But there is the problem. I need to put in a functor, so I don't know the type. And since I cannot define the functor inside the header, I cannot deduce the type.Code:class CVideoEncoderforN8Dlg : public CDialogEx { ... CMyMFCEditBrowseCtrl<?> m_VideoCtrl; ... };
So I need to hide or post-pone the type in some way. So this is what I wanted to ask. What is good solution for this kind of situation? What are some good techniques?



LinkBack URL
About LinkBacks



