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


Please Help Members By Posting Answers For Below Questions

What is the difference between map and hashmap in c++?

563


What is exception handling? Does c++ support exception handling?

591


Differentiate between C and C++.

714


What is null pointer and void pointer?

631


Do we have to use initialization list in spite of the assignment in constructors?

567






Should I learn c or c++ or c#?

559


What is size_type?

551


Is eclipse good for c++?

542


What is a storage class?

647


What are put and get pointers?

584


what is VOID?

635


Inline parameters : What does the compiler do with the parameters of inline function, that can be evaluated in runtime ?

2016


Who created c++?

584


Which is better c++ or java?

566


Can a constructor return a value?

577