Classes, dynamic variables, and leaks.
If I create an instance of a class, and then delete it, I assume that the non-dynamic variables are all cleaned up automatically. The destructor is supposed to be used for dynamically allocated variables, right?
If I use dynamic pointer to create a class, I am assuming that the non-dynamic variables within the class will still be destroyed implicitly, correct? If a dynamic value is assigned within a class, and not handled by the destructor, that would, if I'm not mistaken, create a leak would it not?
I am just trying to check my understanding to make sure I was up to speed. Pls tell me if I am mistaken about anything.
They MAY but they wont by default?
They COULD BE MADE to point to the same location, but as shown they would be seperate?
Lyx :) Yeah prolly, sorry, I'll quit making so many posts if it's a problem.
By the by, do you still need the * for b2->a, like would it actually be b2->*a to get the contents as opposed to the address?
Also, just to make it crystal clear, the delete a; would indeed free up the memory, as opposed to just ending the function without the delete?