Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i use the "reinterpret_cast" operator?

Status
Not open for further replies.

Pyropat

Programmer
May 21, 2001
9
0
0
US
see subject line please
 
reinterpret_cast</*Class to cast to*/>(varToCast)
 
I can try to explain by giving you some examples:
lets say that you have two variables:

int x;
float y;

if you want to cast &quot;x&quot; so it became a float variable,you would have to use this: y = ( float )x;

if you want to cast &quot;y&quot; so it became an int variable,
you could use this: x = ( int )y;

So if you have a variable &quot;z&quot; of &quot;type1&quot;,if you want to convert it to &quot;type2&quot;: you could use z2 = ( type2 )z;
( z2 is a variable of type2 )

I hope that this will help !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top