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
Write a program in C++ for Fibonacci series
Describe the advantage of an external iterator.
What is the use of endl in c++ give an example?
What do you know about near, far and huge pointer?
Which command properly allocates memory a) char *a=new char[20]; b) char a=new char[20]; c) char a=new char(20.0);
Distinguish between new and malloc and delete and free().
Is it possible to provide special behavior for one instance of a template but not for other instances?
Which of the following is not a valid declaration for main() a) int main() b) int main(int argc, char *argv[]) c) They both work
Define the process of handling in case of destructor failure?
Is c++ the hardest language?
Which of the following is evaluated first: a) && b) || c) !
Explain public, protected, private in c++?
What is a rooted hierarchy?
Can there be at least some solution to determine the number of arguments passed to a variable argument list function?
What are the advantages of using const reference arguments in a function?