Results 1 to 5 of 5

Thread: what does this mean ?

  1. #1

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    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?

  2. #2
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    u're right...references are like pointers...
    \m/\m/

  3. #3
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    btw, YES, C# allows pointers in unsafe code
    \m/\m/

  4. #4
    Lively Member
    Join Date
    Aug 2002
    Posts
    126
    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.

  5. #5

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    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
  •  



Click Here to Expand Forum to Full Width