Use dynamic_cast<const Element*>
instead.
You can also make your class const-correct, by implementing two different functions for a const-Argument and a non-const Argument:
static const Element *to_Element(const Node *base) {
return dynamic_cast<const Element*>(base);
}
static Element *to_Element(Node *base) {
return dynamic_cast<Element*>(base);
}
So if the caller has a non-const Node
he probably also wants a non-const Element
and now he can get it...