Finding the 'type' of a component object

This may be more of a general C++ question, but I was wondering if there’s a straight forward way of finding out if a Component object is a Button or Slider or another type of object that is a subclass of the component class?

With dynamic cast?

Perfect, thank-you.