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


Please Help Members By Posting Answers For Below Questions

Write a program for Divide a number with 2 and Print the output ( NOTE: Check for divide by zero error).

910


What are the general quetions are in DEna bank manager IT/System interviews?

1812


What is data abstraction? How is it different from data encapsulation?

794


Write a program which is required to process the time of a clock in hours and minutes, entered from the keyboard. With this program, there are two requirements for any data entered by a user: 1. The data must be of the correct type (in this case, two ints). 2. The data must be in the correct range: this means that, for the minutes, negative numbers and any number above 59 must be rejected; for the hours, negative numbers and any number above 23 must be rejected. Output error message for invalid data input. Output the time one and a half hour after the time input. i.e. Hour: 22 Min: 32 One and a half hour after 22:32 is 00:02

1745


What is a buffer c++?

821


Can c++ do everything c can?

843


What is the difference between delegation and implemented-in-terms-of?

823


How do you declare A pointer to function which receives an int pointer and returns a float pointer

936


How do pointers work?

963


What does 7/9*9 equal ? a) 1 b) 0.08642 c) 0

780


What flag means?

750


Why can’t you call invariants() as the first line of your constructor?

803


Explain method of creating object in C++ ?

837


Explain the virtual inheritance in c++.

836


What is std namespace in c++?

950