Skip to main content
gamedev.net
🔒 Locked

void deconstructors

Started by Cherez Jun 5, 2002 at 6:32 PM 0 replies 600+ views
Original Post
Cherez
Cherez
I''m using void* to store data for an object that can change type in a program I''m working on. This includes some types with deconstructors. Can I just cast the variable to that type when deleting it, or is there some other process needed to destroy it? Thanks!
IndirectX
IndirectX
Yes, you can cast void pointers to other pointer types.

However, void pointers often can be replaced with pointers to non-void data. There''s inheritance and templates, for instance. Void pointers have their uses, but if you are using them to store types with constructors/destructors, it''s better to avoid them.
---visit #directxdev on afternet <- not just for directx, despite the name

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.