Property Set in VBScript
Property Set is very similar to Property Let except that the Property Set procedure is used exclusively for object-based properties. If not explicitly specified using either Public or Private, Property Set procedures are public by default, that is, they are visible to all other procedures in your script. The value of local variables in a Property Set procedure is not preserved between calls to the procedure. You can't define a Property Set procedure inside any other procedure (e.g. Function or Property Let). The Exit Property statement causes an immediate exit from a Property Set procedure. Program execution continues with the statement that follows the statement that called the Property Set procedure. Any number of Exit Property statements can appear anywhere in a Property Set procedure. Like a Function and Property Get procedure, a Property Set procedure is a separate procedure that can take arguments, perform a series of statements, and change the value of its arguments. However, unlike a Function and Property Get procedure, both of which return a value, you can only use a Property Set procedure on the left side of an object reference assignment (Set statement). Note: Every Property Set statement must define at least one argument for the procedure it defines. That argument (or the last argument if there is more than one) contains the actual object reference for the property when the procedure defined by the Property Set statement is invoked. That argument is referred to as reference in the preceding syntax.
Explain constructor and destructor with an example using C#.NET.
Explain constructor and destructor with an example using C#.NET.
A constructor is a member function that performs the task of initializing the objects with the default values to be assigned after creation.
A destructor is a function that is run to release the resources held by an object when it is no longer needed by the application.
In C#.NET we can create constructor and destructor in the following manner:
-----------------CONSTRUCTOR---------
class C
{
private int x;
private int y;
public C (int i, int j)
{
x = i;
y = j;
}
public void display ()
{
Console.WriteLine(x + "i+" + y);
}
}
-----------------DESTRUCTOR---------
class D
{
public D()
{
// constructor
}
~D()
{
// Destructor
}
}