How can I use an enumeration as a template parameter?

Enumerations can be template parameters in exactly the same way that ints can.

enum Enum { ALPHA, BETA };

template <Enum E> class Foo {
    // ...
};

template <> void Foo <ALPHA> :: foo () {
    // specialise
}

class Bar : public Foo <BETA> {
    // OK
}

But you simply haven’t provided a definition for E_EnumerationBase::E_EnumerationBase()

This isn’t a problem with templates or inheritence. It’s the same as if you written this:

struct Foo {
    Foo ();
}
int main () {
    Foo foo;
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)