|
-
November 23rd, 2017, 03:32 AM
#3
Re: Can I use the same variable to initialise two class objects?
 Originally Posted by VictorN
And what are going to do if some Device object is about to destruct?
Are you going to remove its pointer from the QList<Device*>? How?
I honestly hadn't considered this. I had only thought about cleaning up. Each Device object has a unique ID, which the user provides. I could save the Device pointers along with their IDs in a hash table of sorts (QHash or QMap<int,Device*>). This could allow me to delete the specific pointer. And I could add an event in the destructor, so I am informed if a particular object is deleted.
Does this sound right? Or am I overcomplicating what should be a straightforward task?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|