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
what is IFormatable
How do you implement thread synchronization in c#?
What is difference between static and constant variable?
Explain hash table in c# ?
What are strings in c#?
Can you have parameters for static constructors?
Is java better than c sharp?
If I return out of a try/finally in c#, does the code in the finally-clause run?
Explain the difference between a sub and a function in c#.
What is inner class in c#?
Are c# objects passed by reference?
How does bitwise xor work?
What is int parse in c#?
How to parse a date time string?
What is deadlock in c#?