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
if a base class has a number of overloaded constructors, and an inheriting class has a number of overloaded constructors; can you enforce a call from an inherited constructor to a specific base constructor?
What does the keyword “virtual†declare for a method or property?
Can a struct inherit from another struct or class in c#?
What is an argument in c#?
What can I create with c#?
What is thread safe in c#?
Why do we need singleton pattern in c#?
Explain the difference between proc. Sent by val and by sub?
Contrast between an interface and abstract class?
what is collections in .net? why we use?
Define multicast c# delegate?
What are the various components in crystal reports?
What is delegates and events?
Is arraylist type safe in c#?
What are the features of c#?