what is use to destroy an object? illustrate.

Answers were Sorted based on User's Feedback



what is use to destroy an object? illustrate...

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

what is use to destroy an object? illustrate...

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

what is use to destroy an object? illustrate...

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

what is use to destroy an object? illustrate...

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

what is use to destroy an object? illustrate...

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

Post New Answer

More OOPS Interview Questions

143.what is oops principles?

10 Answers  


Why is destructor used?

0 Answers  


Is following functions are said to be overloaded? int add(int a,int b) char *add(int a,int b)

4 Answers  


What are classes oop?

0 Answers  


WAP to find the ambiguities in Multiple Inheritance? How are they resolved.(Virtual Functions)

1 Answers  






what are the different types of qualifier in java?

0 Answers   TCS,


What is inheritance in oop?

0 Answers  


They started with the brief introduction followed by few basic C++ questions on polumorphism, inheritance and then virtual functions. What is polymorphims? How you will access polymorphic functions in C? How virtual function mechanism works?

0 Answers  


The IT giant Tirnop has recently crossed a head count of 150000 and earnings of $7 billion. As one of the forerunners in the technology front, Tirnop continues to lead the way in products and services in India. At Tirnop, all programmers are equal in every respect. They receive identical salaries and also write code at the same rate. Suppose 14 such programmers take 14 minutes to write 14 lines of code in total. How long will in take 5 programmers to write 5 lines of code in total ?

6 Answers   TCS,


What are the benefits of polymorphism?

0 Answers  


why c++ is called OOPS? waht is inherutance? what is compiler?

5 Answers  


sir i want to know which posting to apply since i am BE CSE.. also want to know what are the rounds there for my interview...Expecting for ur valuable answer....

2 Answers  


Categories