dynamic_cast<> with pointers instead of reference and compare against NULL.