|
-
Jan 29th, 2003, 12:08 AM
#1
Thread Starter
Sleep mode
what does this mean ?
When assigning a value to a value type, the value is actually copied. In contrast, for reference types, only the reference is copied; the actual value remains at the same memory location, but now two objects point to it (reference it).
This is really confuses me . All atricles that I've read mentioned that C# is no longer uses pointers .but in the above quote it seems like it still does .any help plz ?
By the way , what is pointers anyways?
-
Jan 29th, 2003, 04:49 AM
#2
yay gay
u're right...references are like pointers...
\m/  \m/
-
Jan 29th, 2003, 04:49 AM
#3
yay gay
btw, YES, C# allows pointers in unsafe code
\m/  \m/
-
Jan 29th, 2003, 09:51 AM
#4
Lively Member
reference type in c# are safe pointers, in contrast of c++ (and other languages) pointers.
there r three types of memory location in .NET applications.
the stack, the heap and the static.
stack contains value types variables which are primitive variables (int, char, struct etc.).
in the heap reside all reference type (user defined objects, .NET base class objects, delegates etc.).
and the static contains all the elements that have been declared as static (methods, variables, classes etc.)
pointers in c++ r very dangerous, because u can modify them to point to any memory location you would like, c# reference variables r pointing to instance objects in the heap, but u cannot assign to them some arbitrary memory address, and that's the big difference.
-
Jan 29th, 2003, 12:56 PM
#5
Thread Starter
Sleep mode
Originally posted by deja
reference type in c# are safe pointers, in contrast of c++ (and other languages) pointers.
there r three types of memory location in .NET applications.
the stack, the heap and the static.
stack contains value types variables which are primitive variables (int, char, struct etc.).
in the heap reside all reference type (user defined objects, .NET base class objects, delegates etc.).
and the static contains all the elements that have been declared as static (methods, variables, classes etc.)
pointers in c++ r very dangerous, because u can modify them to point to any memory location you would like, c# reference variables r pointing to instance objects in the heap, but u cannot assign to them some arbitrary memory address, and that's the big difference.
That's cool deja , thanx for the help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|