Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 1st, 2012  |  syntax: None  |  size: 0.39 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. When I delete an object, are objects referenced within deleted as well?
  2. Fruit^  my_fruit = gcnew Fruit;
  3. Apple^  first_apple = gcnew Apple;
  4. Apple^  second_apple = gcnew Apple;
  5. my_fruit->AppleList->Add(first_apple);
  6. my_fruit->AppleList->Add(second_apple);
  7.  
  8. // some operations
  9.  
  10. delete my_fruit; // **is it enough to avoid memory leak, is it necessary to delete first and second apple objects?**