Use a class destructor to cleanup instead of manually?
I''m wondering if its ok to use a class destructor to clean up the directx devices etc.
Like I have all my direct3d commands in a class, so i thought i could just use the destructor to clean up. Like I have no need to manually do it, only when the program ends.
Thanks
quote:Original post by johnnyBravo
I''m wondering if its ok to use a class destructor to clean up the directx devices etc.
Like I have all my direct3d commands in a class, so i thought i could just use the destructor to clean up. Like I have no need to manually do it, only when the program ends.
Thanks
Yeah, in fact, that''s exactly what you should be doing assuming that the interfaces pointers are encapsulated in the object being destructed, of course.
Also assuming none of the classes have global or static instances. Only put system level stuff in destructors if you''re 100% certain of WHEN destruction will happen.
With global or static instances that''ll be AFTER you return control from WinMain back to the CRT process startup code.
--
Simon O''Connor
3D Programmer &
Microsoft DirectX MVP
With global or static instances that''ll be AFTER you return control from WinMain back to the CRT process startup code.
--
Simon O''Connor
3D Programmer &
Microsoft DirectX MVP
http://sourceforge.net/docman/display_doc.php?docid=8673&group_id=9028
you''re heading the right way...
you''re heading the right way...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement