what is use to destroy an object? illustrate.
Answers were Sorted based on User's Feedback
Answer / rakhi
Object is distroyed when it goes out of the scope and it
can be distroy with its default destructor.
Is This Answer Correct ? | 18 Yes | 0 No |
Answer / sujatha
object can be destroyed by using DESTRUCTORS
EX:
class A
{
int p;
public:
A(int x)
{
x=p;
cout<<"constructor is called memory is allocated to
variable x\n";
}
void show()
{
cout<<"x="<<x;
}
~A()
{
cout<<"destructor called and deaalocte memory occupied by
x\n";
}
};
void main()
{
A a1(10);
a1.show();
}
output
constructor called memory is allocated to variable x
x=10
destructor called and deaalocte memory occupied by x
Is This Answer Correct ? | 9 Yes | 0 No |
Answer / sweety
An object is destroyed to make memory available for further
use by any other object. and this can bo done by using
destructors.
Is This Answer Correct ? | 5 Yes | 0 No |
Answer / safe
an object is destroyed to make memory free which is
allocated by object. it can automatically done by destructor
(default destructor)if we dont call a destructor.
Is This Answer Correct ? | 4 Yes | 1 No |
Answer / sumeet sharma
Simple a destructor function is used for it.
it takes the resources acquired by the object.
it is called when the object goes "out of scope"
Is This Answer Correct ? | 1 Yes | 2 No |
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create.
what is the usage of clas templates
write a program to print * * * * * *
What is protected in oop?
Does c++ support multilevel and multiple inheritance?
What are the components of marker interface?
Example for 4 pillar of oops like, Inheritance,Poly,Abstraction,Encabsulation ?
What is overloading in oops?
why we are declare the function in the abstract class even though we are declaring it in Derived class?
what is object slicing?
write a program that takes input in digits and display the result in words from 1 to 1000
What is a unary operator?