Hi can u please explain me the difference between <static_cast> and <dynamic_cast>. ...?
casting operators
Collapse
X
-
Tags: None
-
I think searching in the net will give you a good idea about this.Originally posted by ankushganatraHi can u please explain me the difference between <static_cast> and <dynamic_cast>. ...?
I suggest this link to start with.
After reading the tutorial you can come back here and post the questions
Raghuram -
The essential difference is that static_cast is a compile time cast whereas dynamic_cast is a runtime cast. That is, the types being used are checked at compile time for static_cast and runtime for dynamic_cast.
Also, dynamic_cast needs RTTI turned on to make that runtime type identification. That feature is a big resource hit.
Which leads me to: Why are you casting anyway??
These C++ cast forms are for emergencies and are not intended to be part of a design.Comment
Comment