Welcome to MSDN Blogs Sign in | Join | Help

Strongly typed boxed values and reference to them...

I just found this on my hard-disk. I thought I would share:

   int ^ stronglyTypedBoxedValue = 1234 ; // C++/CLI feature

   int copyOfUnboxedValue = *stronglyTypedBoxedValue ; 

   int % referenceIntoBox = *stronglyTypedBoxedValue ; // C++/CLI feature

   referenceIntoBox = 4321 ; // Sets the value INSIDE the box!

 

   Debug::Assert( copyOfUnboxedValue == 1234 ) ;

   Debug::Assert( *stronglyTypedBoxedValue == 4321 ) ;

   Debug::Assert( *stronglyTypedBoxedValue == referenceIntoBox ) ;

 

Check Boxing under C++: The Most Powerful Language for .NET Framework Programming if you're interested in those lines of code.

Published Sunday, August 14, 2005 11:06 PM by yvesdolc

Comments

# re: Strongly typed boxed values and reference to them...

Monday, February 20, 2006 12:10 PM by blog
Your site is realy very interesting.
Anonymous comments are disabled
 
Page view tracker