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
What polymorphism means?
What is overriding in oops?
Where is pseudocode used?
Get me an image implementation program.
What is polymorphism programming?
What is abstract class in oop?
What is overloading in oops?
What is inheritance in oop?
Can we have inheritance without polymorphism?
Explain virtual inheritance?
What are the 4 main oop principles?
What is the difference between encapsulation and polymorphism?
What is encapsulation with real life example?
hi all..i want to know oops concepts clearly can any1 explain??
Give an example where we have to specifically use C programming language and C++ programming language cannot be used?