ibm Rational Rhapsody 7.5 — Deleting Components of a Composite

Using Anonymous Instances Deleting Anonymous Instances In Rational Rhapsody, you manage anonymous instances yourself. As a result, it is your responsibility to delete them. Components of composite instances are managed by the composite. To delete them, you must make an explicit request of the composite object. Apply the C++ delete operator as in any conventional C++ program. Deletion of instances involves applying the destructor of that instance. Rational Rhapsody generates a default destructor for every class in the system. You can add code to the destructor through the browser. For example, to delete an instance pointed to by aB , use the following call:

delete aB; Deleting Components of a Composite For each component of a composite, there is a dedicated operation that deletes an instance of that component. For example, deleting an instance pointed to aB from a component named compB in a composite C , use the following call: C->deleteCompB(aB); Rational Rhapsody 955