T
Thomas
Hello,
I need a template class with a type T and a function INIT. For the default
case the INIT-function-pointer should point to the internal member function
init. But since the template parameters depend on the class member function
( see xx in template<class T, void (*INIT)(void)=C_C<T, xx>::init > ) I
don't know how to overcome this problem. Can onybody give me a hint.
Thank You, Thomas
template<class T, void (*INIT)(void)> class C_C;
template<class T, void (*INIT)(void)=C_C<T, xx>::init >
class C_C
{
protected:
static void init(void){ cout << endl << "C_C::init()"; return; }
protected:
T val;
public:
C_C( void ){ INIT(); cout << endl << "+C_C"; return; }
virtual ~C_C( void ) { cout << endl << "-C_C"; return; }
};
I need a template class with a type T and a function INIT. For the default
case the INIT-function-pointer should point to the internal member function
init. But since the template parameters depend on the class member function
( see xx in template<class T, void (*INIT)(void)=C_C<T, xx>::init > ) I
don't know how to overcome this problem. Can onybody give me a hint.
Thank You, Thomas
template<class T, void (*INIT)(void)> class C_C;
template<class T, void (*INIT)(void)=C_C<T, xx>::init >
class C_C
{
protected:
static void init(void){ cout << endl << "C_C::init()"; return; }
protected:
T val;
public:
C_C( void ){ INIT(); cout << endl << "+C_C"; return; }
virtual ~C_C( void ) { cout << endl << "-C_C"; return; }
};