typedef x::ref<buttonObj> button;

typedef x::ref<windowObj> window;

bool is_a_button(const window &w)
    return w->isa<button>();

The isa() x::obj method takes an x::ref or an x::ptr template parameter, and returns true if an x::ref or an x::ptr to this object is capable of getting dynamically casted to the template x::ref or an x::ptr.

This is equivalent to dynamic_cast<buttonObj *>(&*w), but with a clean syntax.