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
Will c++ be replaced?
What should main() return in c and c++?
Explain queue. How it can be implemented?
int age=35; if(age>80) {Console.WriteLine("Boy you are old");} else {Console.WrieLine("That is a good age");}
What is iomanip c++?
What is pointer to member?
Why do we use classes in programming?
Can I make ios apps with c++?
What is the difference between a baller and a reference in C++?
Which coding certification is best?
What are c++ files?
What are the advantages of pointers?
Explain overriding.
How does code-bloating occur in c++?
What's the "software peter principleā?