Describe ways of cleaning up objects.

Answer Posted / vinay tiwari

//we can perform this job with the help of destructor
using System;
class a
{
public int x;
public a(int b)
{
x=b;
}
public void display()
{
Console.WriteLine(x);
}
~a()
{
Console.Write("destroying object which is
created by a()");
}
}
class b
{
static void Main(string [] args)
{
a ob =new a(5);
ob.display();
}
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is IFormatable

762


How do you implement thread synchronization in c#?

651


What is difference between static and constant variable?

760


Explain hash table in c# ?

842


What are strings in c#?

708


Can you have parameters for static constructors?

695


Is java better than c sharp?

701


If I return out of a try/finally in c#, does the code in the finally-clause run?

738


Explain the difference between a sub and a function in c#.

730


What is inner class in c#?

705


Are c# objects passed by reference?

640


How does bitwise xor work?

634


What is int parse in c#?

687


How to parse a date time string?

730


What is deadlock in c#?

661