F
fabioppp
Is this piece of code correct?
template<typename Child>
struct Base
{
enum { derived_id = Child::id }; // <= wont compile!
void invokeDispatch()
{
((Child*) this)->invoke(); // <= this compile fine!
}
};
struct Derived1 : public Base<Type1>
{
enum { id = 1 };
void invoke()
{
}
};
Why the enum doesn't compile, while invokeDispatch seems to be fine?
Thanks
template<typename Child>
struct Base
{
enum { derived_id = Child::id }; // <= wont compile!
void invokeDispatch()
{
((Child*) this)->invoke(); // <= this compile fine!
}
};
struct Derived1 : public Base<Type1>
{
enum { id = 1 };
void invoke()
{
}
};
Why the enum doesn't compile, while invokeDispatch seems to be fine?
Thanks