0 Replies Latest reply on Jan 4, 2007 6:21 PM by sl0beck

    typedef anyone?

    sl0beck Level 1
      I have some data structures I'm making as an intellectual excercise - linked list and variants. They work really well except that there seems to be no way to determine the type of an object. What I thought would be to read the name of the constructor function. but I can't seem to do that either. If anyone knows C++ and knows "typedef" understands what I'm trying to replicate.
      With data structures in C++ one preserves the type of the objects going in and out of a list. For instance, If I have a Linked List of AddressCards. In C++, before instantiating a new list, I can define a type with: typedef ListItemType AddressCard. Then INSIDE the implementation code for the List, I can have the methods that return list items look like this: public function retrieve( index:Number ):ListItemType -- Voi la! no need to type the items like var aCard:AddressCard = AddressCard(List.retrieve(0)); you can trust that the list will pass back items of the type you specified with the typedef statement. Anywho.. I know that's a little advanced, but if any gurus out there can give me a tip, or tell me to give up.

      If anyone wants to look at them, and maybe lend some good advice, I'd be really excited. The files can be found at
      http:www.null.bz/ADT_Lib/ADT_Lib.zip
      The zip includes: The package "adt.list" With "List.as" and it's little sister "Stack.as" a few test files, and some pretty serious documentation (i was bored)

      So, thank you in advance to all the crazy AS pros who I know will shower me with wonderful advice!