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 / mms zubeir

Sorry, there is an error in my above answer. In the first
statement, it is container class, not contained class.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Difference between declaration and definition of a variable.

711


What is the difference between object-oriented programming and procedural programming?

790


What is the latest c++ version?

706


Can we overload operator in c++?

657


What is c++ course?

662






What is microsoft c++ redistributable 2013?

667


Explain the difference between realloc() and free() in c++?

635


What is the use of :: operator in c++?

696


What are vtable and vptr?

715


You want to link a c++ program to c functions. How would you do it?

624


Explain the difference between struct and class in terms of access modifier.

803


What is a virtual destructor? Explain the use of it?

635


Is c++ vector a linked list?

647


Write a program using merge () function to combine the elements of array x[ ] and y[ ] into array z[ ].

689


How a modifier is similar to mutator?

742