Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Doubt about container
Doubt about container [message #52490] Tue, 08 October 2019 10:19 Go to previous message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
I have a doubt about how to keep a class... probably it is extremely simple to solve Smile
This is the story:

- A class (A) has to keep a copy of other class (B)
- A can keep:
-- Case 1. a pointer to an instance of B created with new() by A
-- Case 2. a pointer to an instance of B handled in other place
- When A is destroyed
-- Case 1. B is destroyed in A destructor with a delete
-- Case 2. B is not destroyed. The owner has to destroy it

The problem of Case 2 it is that it is possible that B owner destroys B before A is destroyed... so if A is used in between, it can cause problems.

What is the proper way to do it?


Best regards
IƱaki
 
Read Message
Read Message
Read Message
Previous Topic: BETA status handling
Next Topic: S_type and ValueMap
Goto Forum:
  


Current Time: Fri Mar 29 02:02:42 CET 2024

Total time taken to generate the page: 0.01180 seconds