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

What is binary object model?

596


What is the use of data hiding?

591


What is the type of 'this' pointer? When does it get created?

542


Is map ordered c++?

591


What is binary search in c++?

566






What is ctime c++?

571


How to defines the function in c++?

610


Is swift faster than go?

609


Can the operator == be overloaded for comparing two arrays consisting of characters by using string comparison?

560


What are the various oops concepts in c++?

588


How is c++ used in the real world?

569


Is C++ case sensitive a) False b) Depends on implementation c) True

610


What is long in c++?

731


Difference between declaration and definition of a variable.

583


We all know that a const variable needs to be initialized at the time of declaration. Then how come the program given below runs properly even when we have not initialized p?

576