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
Is vector a class in c++?
Why is c++ awesome?
What kind of jobs can I get with c++?
What is the maximum combined length of command line arguments including the space between adjacent arguments?
What operator is used to access a struct through a pointer a) >> b) -> c) *
Can I have a reference as a data member of a class? If yes, then how do I initialise it?
Is c++ a good beginners programming language?
Explain what you mean by a pointer.
Define private, protected and public access control.
What is object oriented programming (oop)?
Why is standard template library used?
How can we access protected and private members of a class?
What is the difference between the functions rand(), random(), srand() and randomize()?
Explain the virtual inheritance in c++.
What is virtual base class uses?