class ClsTea : IRetail
{
//Variables
private string _locale;
private static string _brand;
// Class Destructor
~ ClsTea()
{
Console.WriteLine("Destructor Called");
// Code to release objects
}
// Class Default Constructor
public ClsTea()
{
Console.WriteLine("Constructor Called");
_brand = "N/A";
}
- A class can only have one destructor.
- Destructors cannot be inherited or overloaded.
- Destructors cannot be called. They are invoked automatically.
- A destructor does not take modifiers or have parameters.
Destructors in .NET, .NET Destructors, How to create a destructor in .NET, How to use destructors in .NET,
See also
How to create and use Static Constructors in C# (.NET)
How to create Default Constructors in C#
What is an Abstract Class / Abstract Classes in C#
No comments:
Post a Comment