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
Why c# is called c sharp?
What are variables in c#?
Is arraylist type safe in c#?
What is eager loading in c#?
Can mvc be used for desktop applications?
Can we overload indexer in c#?
What is windows forms in c#?
What are "class access modifiers" in C#?
In which format you can pass the value in the sleep function?
Is equal in c#?
What is private in c#?
What is a hashset c#?
What is use of list in c#?
Is c# still popular?
Is as keyword in c#?