Structure Pointers & Encapsulation & 'ting

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ballpointpenthief

    #1

    Structure Pointers & Encapsulation & 'ting

    I am trying to build a generic type for data structures in order to be
    able to build complex data structures based on other, simpler data
    structures.

    So, say we have linked lists, doubly linked lists, and hash tables as
    some of our elements, we could build up combinations of these and
    encapsulate them, and then combine these new types to form a new type
    which could be extended further.

    ***One way might be to hold a structure-type pointer in the generic
    data structure***, similar, in a way, to function pointers; but I don't
    think that this is possible in C.

    Is C simply the wrong language to do this kind of thing - I've started
    working my way through the lectures at
    swiss.csail.mit .edu/classes/6.001/abelson-sussman-lectures/ so I'm sure
    it has been done loads of times before - can it be done in C?

  • Herbert Rosenau

    #2
    Re: Structure Pointers & Encapsulation & 'ting

    On Sun, 27 Aug 2006 23:52:40 UTC, "ballpointpenth ief"
    <ballpointpenth ief@yahoo.co.uk wrote:
    I am trying to build a generic type for data structures in order to be
    able to build complex data structures based on other, simpler data
    structures.
    >
    Read your C book what it has to say about the keywords struct and
    union.

    --
    Tschau/Bye
    Herbert

    Visit http://www.ecomstation.de the home of german eComStation
    eComStation 1.2 Deutsch ist da!

    Comment

    Working...