In a class, there is a reference or pointer of an object of
another class embedded, and the memory is either allocated
or assigned to the new object created for this class. In
the constructor, parameters are passed to initialize the
data members and the embedded object reference to get
inialized. What measures or design change should be advised
for proper destruction and avioding memory leaks, getting
pointers dangling for the embedded object memory
allocation? Please suggest.
Answer Posted / shanthila
use copy constructors
Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is the difference between map and hashmap in c++?
What is exception handling? Does c++ support exception handling?
Differentiate between C and C++.
What is null pointer and void pointer?
Do we have to use initialization list in spite of the assignment in constructors?
Should I learn c or c++ or c#?
What is size_type?
Is eclipse good for c++?
What is a storage class?
What are put and get pointers?
what is VOID?
Inline parameters : What does the compiler do with the parameters of inline function, that can be evaluated in runtime ?
Who created c++?
Which is better c++ or java?
Can a constructor return a value?