Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


[a question about linked lists]

This topic is 6127 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i was thinking about this in my assembly class and was wondering how you would translate it to c++: for a linked list instead of having some kind of structure with the data and next pointer, you could just have a pointer to the address of the data, and the next pointer. why would you want to do this? linked two of anything together. i was thinking of making a parent class called ''node'', or something, and then just a void* inside to the data. eg class cNode { public: cNode *next; (void) *data; //other member data and methods }; would that work? the reason i want to do this is so i can link objects to one another. for example i could have a bullet object, and link to that a particle emitter. i could then link the bullet objects to a gun, which i could link to a character''s hand object, which is linked to the arm...etc. i know i could just use a parent class for most of this (and i do), but when it comes to things like particle systems or even sounds, i don''t want a huge all encompassing parent class if i don''t need it. <(o)>

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!