Skip to main content
gamedev.net
🔒 Locked

class question

Started by keethrus Dec 30, 2002 at 11:13 PM 0 replies 200+ views
Original Post
keethrus
keethrus
im creating my own GUI. and each widget can have children widgets. when i create a widget i use new, and i use delete to get rid of it. if each widget has code in its destructor to delete all its children, this would call all the children''s destructors, which would then delete all their children, and so forth. so heres my question, if each widget has a parent, and there is a "DESKTOP" widget in which all widgets are under - to delete all widgets you would simply have to delete the DESKTOP widget, and each and every widget would get deleted - correct? - jeremiah inlovewithGod.com
Thunder_Hawk
Thunder_Hawk
Sounds right....are all of the parent objects under DESKTOP? Or are they all? In the latter case especially, make sure you reset all deleted pointers to 0 or you may get problems trying to delete the same pointer twice (you''ll want to make sure this isn''t happening anyway).
______________________________________________________________________________________The Phoenix shall arise from the ashes... ThunderHawk -- ¦þ"So. Any n00bs need some pointers? I have a std::vector<n00b*> right here..." - ZahlmanMySite | Forum FAQ | File Forma

Topic Locked

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

Sign in to reply to this topic.