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 about the members that a derived class can add?
Can I make ios apps with c++?
How do you compile the source code with your compiler?
Explain the difference between class and struct in c++?
Do vectors start at 0 c++?
Explain how overloading takes place in c++?
How do you differentiate between overloading the prefix and postfix increments?
What is the standard template library (stl)?
What is abstraction c++?
What is the size of a vector?
What is late binding c++?
What is fflush c++?
Array base access faster or pointer base access is faster?
Can the operator == be overloaded for comparing two arrays consisting of characters by using string comparison?
What are punctuators in c++?