Answer Posted / 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 |
Post New Answer View All Answers
Is react oop?
What is object in oop?
What is protected in oop?
What is the oops and benefits of oops programming?
What is object-oriented programming? Webopedia definition
what are the realtime excercises in C++?
What is the difference between static polymorphism and dynamic polymorphism?
What is encapsulation example?
What does I oop mean?
What is an example of genetic polymorphism?
What is oops with example?
hi all..i want to know oops concepts clearly can any1 explain??
What is difference between data abstraction and encapsulation?
What is advantage of inheritance?
How oops is better than procedural?