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

State the difference between pre and post increment/decrement operations.

836


How is c++ different from java?

793


Why do we need constructors in c++?

860


Is dev c++ a good compiler?

718


Difference between overloaded functions and overridden functions

824


What is c++ programming language?

835


What are manipulators used for?

840


Define 'std'.

929


What is function overriding in c++?

820


Is it possible to use a new for the reallocation of pointers ?

816


What is DlgProc?

788


What are the various access specifiers in c++?

805


Difference between overloading vs. Overriding

827


What things would you remember while making an interface?

783


Can we use pointers in c++?

817