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

How const int *ourpointer differs from int const *ourpointer?

612


Is python written in c or c++?

624


What are the new features that iso/ansi c++ has added to original c++ specifications?

588


What is the use of seekg in c++?

599


What is c strings syntax?

610






What kind of problems can be solved by a namespace?

594


What is object in c++ example?

626


Mention the purpose of istream class?

625


What are the benefits of pointers?

601


Describe the role of the c++ in the tradeoff of safety vs. Usability?

715


Arrange Doubly linked list in the ascending order of its integral value and replace integer 5 with 7?

3705


To what does “event-driven” refer?

615


What is the difference between structures and unions?

585


If dog is a friend of boy, and terrier derives from dog, is terrier a friend of boy?

618


What are the benefits of operator overloading?

682