Results 1 to 11 of 11

Thread: Structures?

Threaded View

  1. #6

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Well lets first define what the main difference is between a class(which is a refrence type) and a structure(which is a value type) is. For instance an integer or byte has a fixed number of bytes regardless of the actual value held by the variable. So these are normally stored on the stack. For refrence types such as vectors
    memeory is allocated dynamically so they are commonly stored on the heap.


    As i understand it, the main reason for this seperation is that when a process needs to retrieve a variable it has to search the stack, looking for the variable specified. Now even with complex algorithms the search might take a long perod of time if the stack included large dynamic items such as collections and sets. So a refrence(or pointer) is just stored in a memory address that resides on the stack which points to where the dynamic type resides on the heap.

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