I wanted to know why the following does not work
float f = 12;
int& g = dynamic_cast<int&>(f);
I get the error
cannot dynamic_cast 'f' (of type 'float') to type 'int&' (target is not pointer or reference to class)
int& g = dynamic_cast<int&>(f);
I know dynamic cast deals with both pointers and references so my question is do references only work for class types and not default types ?