Question: > 
> **Possible Duplicate:**  
> 
> [Regular cast vs. static\_cast vs. dynamic\_cast](https://stackoverflow.com/questions/28002/regular-cast-vs-staticcast-vs-dynamiccast) 
> 
> 
> 

I don't quite get when to use static cast and when dynamic. Any explanation please?

Answer: 
`static_cast` is similar to the old C style cast and can be applied to just about anything. `static_cast` would be used when you certain of the types in question. For example, I usually use a `static_cast` when casting between `int` and `enum`.

`dynamic_cast` can only be used with pointers and references. On failure to cast, a null pointer is returned. `dynamic_cast` is generally used when resolving pointers to classes used in inheritance where you want to make sure the pointer you are casting is of the expected type.

Also check out [C++ : Documentation : C++ Language Tutorial : Type Casting](http://www.cplusplus.com/doc/tutorial/typecasting/)
If you are talking about C++. Then static\_cast is not safe type of casting. It can cast to your type but if its wrong it will not throw any error/message. So you will get bad object from that. And the dynamic\_cast is throwing error if the casting failed :) Hope this helps ! :)