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
If a base class declares a function to be virtual, and a derived class does not use the term virtual when overriding that class, is it still virtual when inherited by a third-generation class?
What methods can be overridden in java?
Am studying basic c++ programming, have been given the following assignment. Design a linear program to calculate the maximum stress a material can withstand given a force and a diameter of a circle. To find the required area pi should be defined. Have most of the program sorted out but am at a loss as to how to show the calculations required. Can anyone help?
How can you link a c program with a c function?
What is the full form of stl in c++?
What is a sequence in c++?
How should runtime errors be handled in c++?
Give example of a pure virtual function in c++?
Explain bubble sorting.
What is the protected keyword used for?
What is the correct syntax for inheritance a) class aclass : public superclass b) class aclass inherit superclass c) class aclass <-superclass
What is the v-ptr?
How did c++ get its name?
What are smart pointers?
What is the difference between delegation and implemented-in-terms-of?